public void registerHotkey(Modifier modifier, Keys key, HotkeyPressedCb func) { if (func == null) { throw new ArgumentNullException("func", "Function pointer is null."); } _currentId += 1; if (!RegisterHotKey(_window.Handle, _currentId, (uint)modifier, (uint)key)) { MessageBox.Show("Couldn't register hotkey " + modifier.ToString() + ", " + key.ToString() + "\nIs it already in use by another program?"); } _window.callbacks.Add(new HotkeyCombo((int)modifier, (int)key), func); }
public void registerHotkey(Modifier modifier, Keys key, HotkeyPressedCb func) { if (func == null) { throw new ArgumentNullException("func", "Function pointer is null."); } _currentId += 1; if (!RegisterHotKey(_window.Handle, _currentId, (uint)modifier, (uint)key)) { throw new InvalidOperationException("Couldn't register hotkey."); } _window.callbacks.Add(new HotkeyCombo((int)modifier, (int)key), func); }