private void InitialTray() { notifyIcon = new NotifyIcon { Text = "Wox", Icon = Properties.Resources.app, Visible = true }; notifyIcon.Click += (o, e) => _api.ShowApp(); var open = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTrayOpen")); open.Click += (o, e) => _api.ShowApp(); var setting = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTraySettings")); setting.Click += (o, e) => _api.OpenSettingDialog(); var about = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTrayAbout")); about.Click += (o, e) => _api.OpenSettingDialog("about"); var exit = new MenuItem(InternationalizationManager.Instance.GetTranslation("iconTrayExit")); exit.Click += (o, e) => _api.CloseApp(); MenuItem[] childen = { open, setting, about, exit }; notifyIcon.ContextMenu = new ContextMenu(childen); }
void ctlHotkey_OnHotkeyChanged(object sender, EventArgs e) { if (ctlHotkey.CurrentHotkeyAvailable) { SetHotkey(ctlHotkey.CurrentHotkey, delegate { if (!System.Windows.Application.Current.MainWindow.IsVisible) { _api.ShowApp(); } else { _api.HideApp(); } }); RemoveHotkey(_settings.Hotkey); _settings.Hotkey = ctlHotkey.CurrentHotkey.ToString(); } }
void OnHotkeyChanged(object sender, EventArgs e) { if (HotkeyControl.CurrentHotkeyAvailable) { SetHotkey(HotkeyControl.CurrentHotkey, delegate { if (!Application.Current.MainWindow.IsVisible) { _api.ShowApp(); } else { _api.HideApp(); } }); RemoveHotkey(_settings.Hotkey); _settings.Hotkey = HotkeyControl.CurrentHotkey.ToString(); } }
void ctlHotkey_OnHotkeyChanged(object sender, EventArgs e) { if (ctlHotkey.CurrentHotkeyAvailable) { SetHotkey(ctlHotkey.CurrentHotkey, delegate { if (!App.Window.IsVisible) { _api.ShowApp(); } else { _api.HideApp(); } }); RemoveHotkey(UserSettingStorage.Instance.Hotkey); UserSettingStorage.Instance.Hotkey = ctlHotkey.CurrentHotkey.ToString(); UserSettingStorage.Instance.Save(); } }