Example #1
0
        private void setGlobalShortcutsFromSettings()
        {
            try
            {
                var keyStart = Toggl.GetKeyStart();
                if (keyStart != Key.None)
                {
                    HotkeyManager.Current.AddOrReplace(
                        "Toggl.ContinueOrStop",
                        keyStart,
                        Toggl.GetKeyModifierStart(),
                        onGlobalStartKeyPressed);
                }
                else
                {
                    HotkeyManager.Current.Remove("Toggl.ContinueOrStop");
                }
            }
            catch (Exception e)
            {
                Toggl.Debug("Could not register start shortcut: " + e);
            }

            try
            {
                var keyShow = Toggl.GetKeyShow();
                if (keyShow != Key.None)
                {
                    HotkeyManager.Current.AddOrReplace(
                        "Toggl.ShowHideToggl",
                        keyShow,
                        Toggl.GetKeyModifierShow(),
                        onGlobalShowKeyPressed);
                }
                else
                {
                    HotkeyManager.Current.Remove("Toggl.ShowHideToggl");
                }
            }
            catch (Exception e)
            {
                Toggl.Debug("Could not register show hotkey: " + e);
            }
        }
        private void setGlobalShortcutsFromSettings()
        {
            try
            {
                this.startHook.ChangeTo(
                    Toggl.GetKeyModifierStart(), Toggl.GetKeyStart()
                    );
            }
            catch (Exception e)
            {
                Toggl.Debug("Could not register start shortcut: " + e);
            }

            try
            {
                this.showHook.ChangeTo(
                    Toggl.GetKeyModifierShow(), Toggl.GetKeyShow()
                    );
            }
            catch (Exception e)
            {
                Toggl.Debug("Could not register show hotkey: " + e);
            }
        }