public void SetHotkey(Hotkeyfunction function, Hotkey hk) { try { inputMan.AddUpdateFunctionHotkey(new FunctionHotkey(hk.Key, hk.Modifiers, function)); }catch (Exception ex) { ISLogger.Write("Failed to set hotkey for {0}: {1}", function, ex.Message); } }
/// <summary> /// Removes a hotkey for the specified function /// </summary> /// <exception cref="ArgumentException">hotkey not found</exception>" /// <param name="function">Function hotkey to remove</param> public void RemoveFunctionHotkey(Hotkeyfunction function) { FunctionHotkey fhk = GetFunctionHotkey(function); if (fhk == null) { throw new ArgumentNullException("Hotkey not found"); } hotkeys.Remove(fhk); }
private void HandleFunctionHotkey(object o, Hotkeyfunction function) { if (function == Hotkeyfunction.StopServer) { Stop(); } else if (function == Hotkeyfunction.SendSas) { if (!inputController.CurrentInputClient.IsLocalhost) { inputController.CurrentInputClient.SendInputData(new ISInputData(ISInputCode.IS_SENDSAS, 0, 0).ToBytes()); } } }
protected void OnFunctionHotkeyPressed(Hotkeyfunction function) { FunctionHotkeyPressed?.Invoke(this, function); }
/// <summary> /// Returns the hotkey bound to the specified function (NULL IF NOT FOUND) /// </summary> /// <param name="function">Function of hotkey</param> /// <returns></returns> public FunctionHotkey GetFunctionHotkey(Hotkeyfunction function) { return((FunctionHotkey)hotkeys.Where(key => key.GetType() == typeof(FunctionHotkey)) .Where(key => ((FunctionHotkey)key).Function == function).FirstOrDefault()); }
public FunctionHotkey(WindowsVirtualKey key, HotkeyModifiers mods, Hotkeyfunction function) : base(key, mods) { Function = function; }
public Hotkey GetHotkey(Hotkeyfunction function) { Hotkey hk = inputMan.GetFunctionHotkey(function); return(hk == null ? new Hotkey(0, 0) : hk); }