private void OnMenuItemClicked(object parameter) { switch (parameter as MenuCommand?) { case MenuCommand.ShowSequences: if (m_sequencewindow == null) { m_sequencewindow = new SequenceWindow(); WinForms.Integration.ElementHost.EnableModelessKeyboardInterop(m_sequencewindow); } m_sequencewindow.Show(); m_sequencewindow.Activate(); break; case MenuCommand.ShowOptions: if (m_optionswindow == null) { m_optionswindow = new SettingsWindow(); WinForms.Integration.ElementHost.EnableModelessKeyboardInterop(m_optionswindow); } m_optionswindow.Show(); m_optionswindow.Activate(); break; case MenuCommand.DebugWindow: if (m_debugwindow == null) { m_debugwindow = new DebugWindow(); } m_debugwindow.Show(); m_debugwindow.Activate(); break; case MenuCommand.About: var about_box = new AboutBox(); about_box.ShowDialog(); break; case MenuCommand.Download: var url = Settings.IsInstalled() ? Updater.Get("Installer") : Updater.Get("Portable"); System.Diagnostics.Process.Start(url); break; case MenuCommand.VisitWebsite: System.Diagnostics.Process.Start("http://wincompose.info/"); break; case MenuCommand.Disable: if (Composer.IsDisabled) { m_control.TriggerDisableEvent(); } Composer.ToggleDisabled(); SysTrayUpdateCallback(null, new EventArgs()); break; case MenuCommand.Restart: // FIXME: there might be more cleanup to do here; but it’s probably // not worth it, because restarting the app is a hack and whatever // reason the user may have, it’s because of a bug or a limitation // in WinCompose that we need to fix. m_icon.Visible = false; WinForms.Application.Restart(); Environment.Exit(0); break; case MenuCommand.Exit: WinForms.Application.Exit(); break; } }
private static void ShowOptionsClicked(object sender, EventArgs e) { if (m_optionswindow == null) { m_optionswindow = new SettingsWindow(); ElementHost.EnableModelessKeyboardInterop(m_optionswindow); } m_optionswindow.Show(); }