private static void UpdaterStateChanged(object sender, EventArgs e) { m_download_item.Visible = false; if (Updater.HasNewerVersion()) { var text = string.Format(i18n.Text.Download, Updater.Get("Latest") ?? ""); var url = Settings.IsInstalled() ? Updater.Get("Installer") : Updater.Get("Portable"); if (url != null) { m_download_item.Visible = true; m_download_item.Text = text; m_download_url = url; } } }
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 void OnMenuItemClicked(object parameter) { switch (parameter as MenuCommand?) { case MenuCommand.ShowSequences: m_sequencewindow = m_sequencewindow ?? new SequenceWindow(); m_sequencewindow.Show(); m_sequencewindow.Activate(); break; case MenuCommand.ShowOptions: m_optionswindow = m_optionswindow ?? new SettingsWindow(); m_optionswindow.Show(); m_optionswindow.Activate(); break; case MenuCommand.DebugWindow: m_debugwindow = m_debugwindow ?? new DebugWindow(); m_debugwindow.Show(); m_debugwindow.Activate(); break; case MenuCommand.About: m_about_box = m_about_box ?? new AboutBox(); m_about_box.Show(); m_about_box.Activate(); 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.DonationPage: System.Diagnostics.Process.Start("http://wincompose.info/donate/"); break; case MenuCommand.Disable: if (Composer.IsDisabled) { Application.RemoteControl.BroadcastDisableEvent(); } Composer.ToggleDisabled(); 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; Application.Current.Shutdown(); WinForms.Application.Restart(); Environment.Exit(0); break; case MenuCommand.Exit: Application.Current.Shutdown(); break; } }
private void OnCommand(object o) { switch (o as MenuCommand?) { case MenuCommand.ShowSequences: m_sequencewindow = m_sequencewindow ?? new SequenceWindow(); m_sequencewindow.Show(); m_sequencewindow.Activate(); break; case MenuCommand.ShowOptions: m_optionswindow = m_optionswindow ?? new SettingsWindow(); m_optionswindow.Show(); m_optionswindow.Activate(); break; case MenuCommand.DebugWindow: m_debugwindow = m_debugwindow ?? new DebugWindow(); m_debugwindow.Show(); m_debugwindow.Activate(); break; case MenuCommand.About: m_about_box = m_about_box ?? new AboutBox(); m_about_box.Show(); m_about_box.Activate(); break; case MenuCommand.Download: var url = Settings.IsInstalled() ? Updater.Get("Installer") : Updater.Get("Portable"); Process.Start(url); break; case MenuCommand.VisitWebsite: Process.Start("http://wincompose.info/"); break; case MenuCommand.DonationPage: Process.Start("http://wincompose.info/donate/"); break; case MenuCommand.Disable: if (Composer.IsDisabled) { Application.RemoteControl.BroadcastDisableEvent(); } Composer.ToggleDisabled(); 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. Visibility = System.Windows.Visibility.Collapsed; Application.Current.Exit += (s, e) => Process.Start(Application.ResourceAssembly.Location); Application.Current.Shutdown(); break; case MenuCommand.Exit: Application.Current.Shutdown(); break; } }