Exemplo n.º 1
0
        // Minimize to system tray when application is closed.
        protected override void OnClosing(CancelEventArgs e)
        {
            // if hideOnClose
            // setting cancel to true will cancel the close request
            // so the application is not closed
            if (Properties.Settings.Default.hideOnClose && !this.trayClose)
            {
                e.Cancel = true;
                this.Hide();
                base.OnClosing(e);
            }

            if (!Properties.Settings.Default.hideOnClose || this.trayClose)
            {
                ni.Visible = false;
                MouseHook.Stop();
                HotkeysManager.ShutdownSystemHook();
                Properties.Settings.Default.Save();
                if (LogWatcher.WorkerThread != null && LogWatcher.WorkerThread.IsAlive)
                {
                    LogWatcher.StopWatchingLogFile();
                }
                //overlay.Close();
                //stashTabOverlay.Close();
                App.Current.Shutdown();
            }
        }
Exemplo n.º 2
0
 public void RemoveAllHotkeys()
 {
     HotkeysManager.RemoveRefreshHotkey();
     HotkeysManager.RemoveStashTabHotkey();
     HotkeysManager.RemoveToggleHotkey();
     //HotkeysManager.RemoveReloadFilterHotkey();
 }
Exemplo n.º 3
0
        private void SaveHotkeyButton_Click(object sender, RoutedEventArgs e)
        {
            switch (_type)
            {
            case "refresh":
            {
                HotkeysManager.RemoveHotkey(HotkeysManager.refreshModifier, HotkeysManager.refreshKey);
                if (CustomHotkeyToggle.Hotkey == null)
                {
                    Settings.Default.HotkeyRefresh = "< not set >";
                }
                else
                {
                    Settings.Default.HotkeyRefresh = CustomHotkeyToggle.Hotkey.ToString();
                    HotkeysManager.GetRefreshHotkey();
                }

                ReApplyHotkeys();
                break;
            }

            case "toggle":
            {
                HotkeysManager.RemoveHotkey(HotkeysManager.toggleModifier, HotkeysManager.toggleKey);
                if (CustomHotkeyToggle.Hotkey == null)
                {
                    Settings.Default.HotkeyToggle = "< not set >";
                }
                else
                {
                    Settings.Default.HotkeyToggle = CustomHotkeyToggle.Hotkey.ToString();
                    HotkeysManager.GetToggleHotkey();
                }

                ReApplyHotkeys();
                break;
            }

            case "stashtab":
            {
                HotkeysManager.RemoveHotkey(HotkeysManager.stashTabModifier, HotkeysManager.stashTabKey);
                if (CustomHotkeyToggle.Hotkey == null)
                {
                    Settings.Default.HotkeyStashTab = "< not set >";
                }
                else
                {
                    Settings.Default.HotkeyStashTab = CustomHotkeyToggle.Hotkey.ToString();
                    HotkeysManager.GetStashTabHotkey();
                }

                ReApplyHotkeys();
                break;
            }
            }

            Close();
        }
Exemplo n.º 4
0
 private void InitializeHotkeys()
 {
     HotkeysManager.SetupSystemHook();
     HotkeysManager.RequiresModifierKey = false;
     HotkeysManager.GetRefreshHotkey();
     HotkeysManager.GetToggleHotkey();
     HotkeysManager.GetStashTabHotkey();
     AddAllHotkeys();
 }
Exemplo n.º 5
0
 public void AddAllHotkeys()
 {
     if (Properties.Settings.Default.HotkeyRefresh != "< not set >")
     {
         HotkeysManager.AddHotkey(HotkeysManager.refreshModifier, HotkeysManager.refreshKey, overlay.RunFetching);
     }
     if (Properties.Settings.Default.HotkeyToggle != "< not set >")
     {
         HotkeysManager.AddHotkey(HotkeysManager.toggleModifier, HotkeysManager.toggleKey, RunOverlay);
     }
     if (Properties.Settings.Default.HotkeyStashTab != "< not set >")
     {
         HotkeysManager.AddHotkey(HotkeysManager.stashTabModifier, HotkeysManager.stashTabKey, RunStashTabOverlay);
     }
 }
 private void SaveHotkeyButton_Click(object sender, RoutedEventArgs e)
 {
     if (type == "refresh")
     {
         HotkeysManager.RemoveHotkey(HotkeysManager.refreshModifier, HotkeysManager.refreshKey);
         if (CustomHotkeyToggle.Hotkey == null)
         {
             Properties.Settings.Default.HotkeyRefresh = "< not set >";
         }
         else
         {
             Properties.Settings.Default.HotkeyRefresh = CustomHotkeyToggle.Hotkey.ToString();
             HotkeysManager.GetRefreshHotkey();
         }
         ReApplyHotkeys();
     }
     else if (type == "toggle")
     {
         HotkeysManager.RemoveHotkey(HotkeysManager.toggleModifier, HotkeysManager.toggleKey);
         if (CustomHotkeyToggle.Hotkey == null)
         {
             Properties.Settings.Default.HotkeyToggle = "< not set >";
         }
         else
         {
             Properties.Settings.Default.HotkeyToggle = CustomHotkeyToggle.Hotkey.ToString();
             HotkeysManager.GetToggleHotkey();
         }
         ReApplyHotkeys();
     }
     else if (type == "stashtab")
     {
         HotkeysManager.RemoveHotkey(HotkeysManager.stashTabModifier, HotkeysManager.stashTabKey);
         if (CustomHotkeyToggle.Hotkey == null)
         {
             Properties.Settings.Default.HotkeyStashTab = "< not set >";
         }
         else
         {
             Properties.Settings.Default.HotkeyStashTab = CustomHotkeyToggle.Hotkey.ToString();
             HotkeysManager.GetStashTabHotkey();
         }
         ReApplyHotkeys();
     }
     this.Close();
 }
Exemplo n.º 7
0
        //
        //protected override void OnStateChanged(EventArgs e)
        //{
        //    Trace.WriteLine("minimize");
        //    if (this.WindowState == WindowState.Minimized)
        //    {
        //        Trace.WriteLine("Windowstate minimized");
        //        this.Hide();
        //        if()
        //    }
        //    base.OnStateChanged(e);
        //}

        // Minimize to system tray when application is closed.
        protected override void OnClosing(CancelEventArgs e)
        {
            // if hideOnClose
            // setting cancel to true will cancel the close request
            // so the application is not closed
            if (Properties.Settings.Default.hideOnClose && !this.trayClose)
            {
                e.Cancel = true;
                this.Hide();
                base.OnClosing(e);
            }

            if (!Properties.Settings.Default.hideOnClose || this.trayClose)
            {
                ni.Visible = false;
                HotkeysManager.ShutdownSystemHook();
                Properties.Settings.Default.Save();
                //overlay.Close();
                //stashTabOverlay.Close();
                App.Current.Shutdown();
            }
        }
Exemplo n.º 8
0
 public static void RemoveRefreshHotkey()
 {
     HotkeysManager.RemoveHotkey(refreshModifier, refreshKey);
 }
Exemplo n.º 9
0
 public static void RemoveStashTabHotkey()
 {
     HotkeysManager.RemoveHotkey(stashTabModifier, stashTabKey);
 }
Exemplo n.º 10
0
        //public static void GetReloadFilterHotkey()
        //{
        //    if (Properties.Settings.Default.HotkeyReloadFilter != "< not set >")
        //    {
        //        string[] reloadFilterString = Properties.Settings.Default.HotkeyReloadFilter.Split('+');

        //        if (reloadFilterString.Length > 1)
        //        {
        //            if (reloadFilterString[0].Trim() == "Ctrl")
        //            {
        //                reloadFilterModifier = ModifierKeys.Control;
        //            }
        //            else if (reloadFilterString[0].Trim() == "Alt")
        //            {
        //                reloadFilterModifier = ModifierKeys.Alt;
        //            }
        //            else if (reloadFilterString[0].Trim() == "Win")
        //            {
        //                reloadFilterModifier = ModifierKeys.Windows;
        //            }
        //            else if (reloadFilterString[0].Trim() == "Shift")
        //            {
        //                reloadFilterModifier = ModifierKeys.Shift;
        //            }
        //            else
        //            {
        //                reloadFilterModifier = ModifierKeys.None;
        //            }

        //            Enum.TryParse(reloadFilterString[1].Trim(), out reloadFilterKey);
        //        }
        //        else
        //        {
        //            Enum.TryParse(reloadFilterString[0].Trim(), out reloadFilterKey);
        //            reloadFilterModifier = ModifierKeys.None;
        //        }
        //    }
        //}

        public static void RemoveToggleHotkey()
        {
            HotkeysManager.RemoveHotkey(toggleModifier, toggleKey);
        }