Example #1
0
        private void NotifyIconContextMenu_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            // Open SubSync

            if (e.ClickedItem == NotifyIconContextMenuItemOpenGUI)
            {
                WindowManager.OpenWindow(typeof(SetupForm));
            }

            // Start/Stop SubSync

            if (e.ClickedItem == NotifyIconContextMenuItemStartStop)
            {
                StartStopSync();
            }

            // Check for subtitles now

            if (e.ClickedItem == NotifyIconContextMenuItemLanguageSettings)
            {
                WindowManager.OpenWindow(typeof(LanguageSelectionForm));
            }

            // Check for subtitles now

            if (e.ClickedItem == NotifyIconContextMenuItemCheckNow)
            {
                SyncManager.CheckForSubtitlesNow();
            }

            // Check for updates

            if (e.ClickedItem == NotifyIconContextMenuItemCheckUpdates)
            {
                Task.Run(() =>
                {
                    TaskManager.AntecipateTask <CheckForUpdatesJob>(false);
                });
            }

            // About SubSync

            if (e.ClickedItem == NotifyIconContextMenuItemAbout)
            {
                WindowManager.OpenWindow(typeof(AboutForm));
            }

            // Exit

            if (e.ClickedItem == NotifyIconContextMenuItemExit)
            {
                Application.Exit();
                // Included due to application threads still running after Application Exit
                // TODO: Validate if this the right way to do this
                Process.GetCurrentProcess().Kill();
            }
        }