コード例 #1
0
 public void Remove(HotkeyBinding binding)
 {
     if (!_loaded)
     {
         throw new NullReferenceException(Properties.strings.Bindings_not_loaded);
     }
     Bindings.Remove(binding);
     Save();
 }
コード例 #2
0
        public void UpdateAt(int index, HotkeyBinding binding)
        {
            if (!_loaded)
            {
                throw new NullReferenceException(Properties.strings.Bindings_not_loaded);
            }

            Bindings[index] = binding;
            Save();
        }
コード例 #3
0
        public int Add(HotkeyBinding binding)
        {
            if (!_loaded)
            {
                throw new NullReferenceException(Properties.strings.Bindings_not_loaded);
            }
            Bindings.Add(binding);

            Save();
            return(Bindings.IndexOf(binding));
        }
コード例 #4
0
        public void HotkeyCallback(Message m)
        {
            HotkeyBinding triggeredBinding = Program.BindingManager.Get(m.WParam.ToInt32());


            /* uint pid;
             * Win32Helper.GetWindowThreadProcessId(Win32Helper.GetForegroundWindow(), out pid);
             * Process p = Process.GetProcessById((int)pid);
             * string processName = p.ProcessName.ToLower();
             *
             *
             * if (triggeredBinding.Blacklist)
             * {
             *   foreach (var s in triggeredBinding.ProcessList)
             *   {
             *       string sL = s.ToLower();
             *       if (sL.EndsWith(".exe"))
             *       {
             *           sL = sL.Remove(sL.Length - 4, 4 );
             *       }
             *       if (sL == processName)
             *       {
             *
             *
             *           return;
             *       }
             *   }
             *
             * } else {
             *   bool run = false;
             *   foreach (var s in triggeredBinding.ProcessList)
             *   {
             *       if (s.ToLower() == processName)
             *       {
             *           run = true;
             *           break;
             *       }
             *
             *   }
             *   if (!run)
             *       return;
             * }*/

            if (triggeredBinding.IsPython)
            {
                if (triggeredBinding.CapsActionEnabled && Control.IsKeyLocked(Keys.Capital))
                {
                    PythonSend(triggeredBinding.ActionAlternate);
                }
                else
                {
                    PythonSend(triggeredBinding.Action);
                }
            }
            else
            {
                if (triggeredBinding.CapsActionEnabled && Control.IsKeyLocked(Keys.Capital))
                {
                    Win32.Send(triggeredBinding.ActionAlternate);
                }
                else
                {
                    Win32.Send(triggeredBinding.Action);
                }
            }
        }