Ejemplo n.º 1
0
        private void Release()
        {
            _hotKeysManager?.UnHook();
            _hotKeysManager?.Dispose();
            _hotKeysManager = null;

            ReleaseSlots();
        }
Ejemplo n.º 2
0
 /// <summary>
 ///  If you want to associate reserved hotkeys that are used for something external to MonKey,
 /// you can specify it here, and it will appear visible in the console when a conflict happens.
 /// </summary>
 /// <param name="commandName"></param>
 /// <param name="hotKeys"></param>
 public static void AddCustomReservedHotKeys(string commandName, params string[] hotKeys)
 {
     HotKeysManager.RegisterCommandHotKey(new CommandInfo()
     {
         CommandName = commandName,
         HotKey      = (new KeyCombination(hotKeys))
     });
 }
Ejemplo n.º 3
0
        public static void Initialize()
        {
            _hkManager = new HotKeysManager();
            _hkManager.AddHotKey(new HotKeyCombination(new System.Windows.Forms.Keys[] {
                System.Windows.Forms.Keys.LWin,
                System.Windows.Forms.Keys.Y
            }, new HotKeyEventHandler(() =>
            {
                ShowFastWindow();
            })));

            _hkManager.EnableHotKeys();

            _notifyIcon = new System.Windows.Forms.NotifyIcon();
            _notifyIcon.Icon = new System.Drawing.Icon(FSHelper.GetImgLocation("logo_32.ico"));
            _notifyIcon.Visible = true;

            _notifyIcon.MouseClick += (o, e) =>
            {
                if (e.Button == System.Windows.Forms.MouseButtons.Right)
                {
                    if (_mainWindow == null)
                    {
                        _mainWindow = new MainWindow();
                        App.Current.Dispatcher.BeginInvoke(new Action(() =>
                            {
                                _mainWindow.Show();
                            }),
                        System.Windows.Threading.DispatcherPriority.Normal, null);
                        _mainWindow.Closing += (oo, ee) =>
                        {
                            _mainWindow = null;
                        };
                    }
                }
                else if (e.Button == System.Windows.Forms.MouseButtons.Left)
                {
                    ShowFastWindow();
                }
            };
        }
Ejemplo n.º 4
0
 private void CreateHotKeysHook()
 {
     _hotKeysManager          = new HotKeysManager();
     _hotKeysManager.KeyDown += OnKeyDown;
     _hotKeysManager.KeyUp   += OnKeyUp;
 }
Ejemplo n.º 5
0
        private void OnGUI()
        {
            if (isDockedInfo == null)
            {
                return;
            }

            if (SearchTerms == "`" ||
                (MonKeyInternalSettings.Instance.UseCustomConsoleKey &&
                 SearchTerms == MonKeyInternalSettings.Instance.MonkeyConsoleOverrideHotKey))
            {
                ResetSearchTerms();

                /*if (!JustOpenedActiveMode)
                 *  CloseOrSetInactive();*/
            }

            HotKeysManager.CheckCustomHotKey();

            HandleMouse();

            MonkeyStyle.Instance.InitDefaultStyle();
            GUI.skin = MonkeyStyle.Instance.DefaultStyle;

            if (TabFrames > 0)
            {
                TabFrames--;
                Focus();
            }

            if (!CurrentPanel)
            {
                //   ToggleMonkeyPanel();
                //not sure why needed now, tbc
                return;
            }

            if (!Focused)
            {
                if ((!IsDocked && !MonKeyInternalSettings.Instance.PreventFocusOnPopup) ||
                    (isActiveMode && MonKeyInternalSettings.Instance.ForceFocusOnDocked))
                {
                    Focus();
                }
            }

            if (!isActiveMode)
            {
                if (Event.current.type == EventType.MouseDown)
                {
                    Event.current.Use();
                    ToggleMonkeyPanel();
                    Repaint();
                    return;
                }

                try
                {
                    SleepingMonkeyPanelDisplay.DisplaySleepingMonkey();
                    // OnGUIActiveMode();
                    if (CommandManager.Instance.IsLoading)
                    {
                        LoadingNoticeDisplay.DisplayLoadingNotice(this);
                    }
                }
                catch (Exception e)
                {
                    if (LogExceptions)
                    {
                        Debug.Log(e);
                    }
                    GUIUtility.ExitGUI();
                }

                return;
            }

            OnGUIActiveMode();
        }