private void Register() { if (hWnd == null) { hWnd = new HotkeyForm(); hWnd.CreateHandle(new CreateParams()); } if (!this.Enabled) { MOD modifiers = 0; if ((this.Keys & Keys.Alt) == Keys.Alt) { modifiers = modifiers | MOD.MOD_ALT; } if ((this.Keys & Keys.Control) == Keys.Control) { modifiers = modifiers | MOD.MOD_CONTROL; } if ((this.Keys & Keys.Shift) == Keys.Shift) { modifiers = modifiers | MOD.MOD_SHIFT; } Keys k = this.Keys & ~Keys.Control & ~Keys.Shift & ~Keys.Alt; this.ID = (new Random()).Next(0x1000, 0xbfff); NativeMethod.RegisterHotKey(hWnd.Handle, this.ID, modifiers, k).CheckError(); this.Enabled = true; hWnd.Handler += this.hWndHotkeyEvent; } }
private void editHotkeysButton_Click(object sender, EventArgs e) { int centerX = DesktopLocation.X + (Width / 2); int centerY = DesktopLocation.Y + (Height / 2); var hotkeyForm = new HotkeyForm(centerX - 321 / 2, centerY - 217 / 2, Hotkeys); hotkeyForm.ShowDialog(); Hotkeys = hotkeyForm.Hotkeys; ApplyHotkeys(); }
public HotkeyManager(HotkeyForm hotkeyForm, List<HotkeySettings> hotkeys, HotkeyTriggerEventHandler action) { this.hotkeyForm = hotkeyForm; triggerAction = action; Hotkeys = hotkeys; if (Hotkeys.Count == 0) { ResetHotkeys(); } }
public HotkeyManager(HotkeyForm form, List<HotkeySettings> hotkeys) { hotkeyForm = form; hotkeyForm.HotkeyPress += hotkeyForm_HotkeyPress; hotkeyForm.FormClosed += (sender, e) => hotkeyForm.InvokeSafe(() => UnregisterAllHotkeys(false)); Hotkeys = hotkeys; if (Hotkeys.Count == 0) { ResetHotkeys(); } else { RegisterAllHotkeys(); } ShowFailedHotkeys(); }
public Hotkey(MOD_KEY ModKey, Keys Key) { Form = new HotkeyForm(ModKey, Key, RaiseHotkeyPush); }
public HotkeyManager(HotkeyForm hotkeyForm, ZAppType host) { this.hotkeyForm = hotkeyForm; this.Host = host; }