Ejemplo n.º 1
0
        private void HotKeyPressed(short id, IntPtr currentWindowHandle)
        {
            HotKeyFunction functionCalled = Runtime.Instance.Settings.HotKeys.GetFunction(id);

            Runtime.Instance.WriteDebug(nameof(HotKeyPressed), nameof(functionCalled), functionCalled, "HotKeys");
            switch (functionCalled)
            {
            case HotKeyFunction.HideCurrentWindow:
                if (!currentWindowHandle.Equals(IntPtr.Zero))
                {
                    WindowInfo.Find(currentWindowHandle).Hide();
                }
                break;

            case HotKeyFunction.UnhideAllWindows:
                this.UnhideAllWindows(this, new EventArgs());
                break;

            case HotKeyFunction.ToggleLastWindow:
                WindowInfo.Last?.ToggleHidden();
                break;

            case HotKeyFunction.UnhideLastWindow:
                Runtime.Instance.WindowManager.GetLastWindow()?.Show();
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
 private HotKey(HotKeyFunction function, Keys key, HotModifierKeys modifiers)
     : this()
 {
     this.Function     = function;
     this.Key          = key;
     this.ModifierKeys = modifiers;
 }
Ejemplo n.º 3
0
 private HotKey(HotKeyFunction function, Keys key, HotModifierKeys modifiers)
     : this()
 {
     this.Function = function;
     this.Key = key;
     this.ModifierKeys = modifiers;
 }
        internal static HotKey AddOrFind(HotKeyFunction hotKeyFunction)
        {
            HotKey hkey = Runtime.Instance.Settings.HotKeys.ToList().Find(x => x.Function == hotKeyFunction);
            if (hkey == null)
            {
                Runtime.Instance.Settings.HotKeys.Add(hkey = new HotKey(hotKeyFunction));
            }

            return hkey;
        }
        internal static HotKey AddOrFind(HotKeyFunction hotKeyFunction)
        {
            HotKey hkey = Runtime.Instance.Settings.HotKeys.ToList().Find(x => x.Function == hotKeyFunction);

            if (hkey == null)
            {
                Runtime.Instance.Settings.HotKeys.Add(hkey = new HotKey(hotKeyFunction));
            }

            return(hkey);
        }
        private int IndexOf(HotKeyFunction function)
        {
            for (int i = 0; i < this.Count; i++)
            {
                if (this[i].Function == function)
                {
                    return(i);
                }
            }

            return(-1);
        }
 public HotKey this[HotKeyFunction function]
 {
     get { return(this.Find(function)); }
     set
     {
         int index = this.IndexOf(function);
         if (index == -1)
         {
             this.Add(value);
         }
         else
         {
             this[index] = value;
         }
     }
 }
Ejemplo n.º 8
0
 public HotKey GetHotKeyByFunction(HotKeyFunction function)
 {
     return(this.HotKeys.FirstOrDefault(hotKey => hotKey.Function == function) ?? new HotKey(function));
 }
Ejemplo n.º 9
0
 public HotKey GetHotKeyByFunction(HotKeyFunction function)
 {
     return this.HotKeys.FirstOrDefault(hotKey => hotKey.Function == function) ?? new HotKey(function);
 }
Ejemplo n.º 10
0
 public HotKey(HotKeyFunction function)
     : this()
 {
     this.Function = function;
 }
Ejemplo n.º 11
0
 public HotKey Find(HotKeyFunction function)
 {
     return(this.FirstOrDefault(item => item.Function.Equals(function)));
 }
Ejemplo n.º 12
0
 public bool Exists(HotKeyFunction function)
 {
     return(this.Any(key => key.Function.Equals(function)));
 }
Ejemplo n.º 13
0
 public HotKey(HotKeyFunction function)
     : this()
 {
     this.Function = function;
 }