Beispiel #1
0
        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);
        }
Beispiel #2
0
 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();
     }
 }
Beispiel #3
0
 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();
     }
 }
Beispiel #4
0
 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();
     }
 }