Ejemplo n.º 1
0
 internal Action RestorePrimaryButtonClickEvent()
 {
     return(() =>
     {
         if (primaryEvent == Def.Constant.LeftButtonDown)
         {
             InputSender.LeftClick();
         }
         else if (primaryEvent == Def.Constant.MiddleButtonDown)
         {
             InputSender.MiddleClick();
         }
         else if (primaryEvent == Def.Constant.RightButtonDown)
         {
             InputSender.RightClick();
         }
         else if (primaryEvent == Def.Constant.X1ButtonDown)
         {
             InputSender.X1Click();
         }
         else if (primaryEvent == Def.Constant.X2ButtonDown)
         {
             InputSender.X2Click();
         }
     });
 }
Ejemplo n.º 2
0
        public void LowLevelMouseHookProcTest()
        {
            var sender = new SingleInputSender();
            var list   = new List <LowLevelMouseHook.Event>();
            var hook   = new LowLevelMouseHook((evnt, data) => {
                if (data.fromCreviceApp)
                {
                    list.Add(evnt);
                    return(LowLevelMouseHook.Result.Cancel);
                }
                return(LowLevelMouseHook.Result.Transfer);
            });

            Assert.AreEqual(list.Count, 0);
            hook.SetHook();
            sender.RightClick();
            hook.Unhook();
            Assert.AreEqual(list.Count, 2);
        }
Ejemplo n.º 3
0
 public void RightClickTest()
 {
     sender.RightClick();
     Assert.AreEqual(mouseEvents[0].Item1, LowLevelMouseHook.Event.WM_RBUTTONDOWN);
     Assert.AreEqual(mouseEvents[1].Item1, LowLevelMouseHook.Event.WM_RBUTTONUP);
 }