Ejemplo n.º 1
0
 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);
     }
 }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
 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());
         }
     }
 }
Ejemplo n.º 4
0
 protected void OnFunctionHotkeyPressed(Hotkeyfunction function)
 {
     FunctionHotkeyPressed?.Invoke(this, function);
 }
Ejemplo n.º 5
0
 /// <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());
 }
Ejemplo n.º 6
0
 public FunctionHotkey(WindowsVirtualKey key, HotkeyModifiers mods, Hotkeyfunction function) : base(key, mods)
 {
     Function = function;
 }
Ejemplo n.º 7
0
        public Hotkey GetHotkey(Hotkeyfunction function)
        {
            Hotkey hk = inputMan.GetFunctionHotkey(function);

            return(hk == null ? new Hotkey(0, 0) : hk);
        }