Ejemplo n.º 1
0
        public void RegisterAppHotKey()
        {
            INIFile root = Config.IniFile;

            this.userHotkey = new Hotkey2(Hotkey2.KeyCodeFromString(Config.KeyCode), Config.ShiftKey, Config.ControlKey, Config.AltKey, Config.WindowsKey);
            // Catch the 'Pressed' event
            this.userHotkey.Pressed += delegate(object sender1, HandledEventArgs ee)
            {
                this.ShowMainForm();
            };

            this.userHotkey.Register(this);
            if (this.userHotkey.GetCanRegister(this))
            {
                MessageBox.Show("register hotkey fail!");
            }


            /*
             *          Hotkey2 hk = new Hotkey2(Keys.A, false, true, false, true);
             *          hk.Register(this);
             *
             *          if (hk.GetCanRegister(this)) {
             *                  MessageBox.Show("register hotkey fail!");
             *          }
             *
             *          hk.Pressed+= delegate(object sender1, HandledEventArgs ee) {
             *                  this.ShowMainForm();
             *          };*/
        }
Ejemplo n.º 2
0
        private void InitHotkey()
        {
            INIFile root = Config.IniFile;

            ProxyForm.Instance.userHotkey.Reregister(Hotkey2.KeyCodeFromString(Config.KeyCode), Config.ShiftKey, Config.ControlKey, Config.AltKey, Config.WindowsKey);

            // Set up our form:
            for (Keys k = Keys.A; k <= Keys.Z; k++)
            {
                AddKeyToComboBox(k);
            }
            for (Keys k = Keys.F1; k <= Keys.F24; k++)
            {
                AddKeyToComboBox(k);
            }

            // Update the form now controls
            this.shiftCheckBox.Checked   = this.userHotkey.Shift;
            this.controlCheckBox.Checked = this.userHotkey.Control;
            this.altCheckBox.Checked     = this.userHotkey.Alt;
            this.windowsCheckBox.Checked = this.userHotkey.Windows;
        }