Example #1
0
        public override Task Execute(IRfbClient vncClient)
        {
            if (Action == Command.Drag)
            {
                return(Task.Run(async() =>
                {
                    vncClient.SendMouseClick(X, Y, 0);
                    vncClient.SendMouseClick(X, Y, 1);

                    int dx = (X2 - X) / 10;
                    int dy = (Y2 - Y) / 10;
                    Console.WriteLine("before x:" + X + " y:" + Y);
                    for (int i = 1; i < 10; i++)
                    {
                        await Task.Delay(100);
                        ushort dPx = (ushort)(X + (dx * i));
                        ushort dPy = (ushort)(Y + (dy * i));
                        Console.WriteLine("in x:" + dPx + " y:" + dPy);
                        vncClient.SendMouseClick(Convert.ToUInt16(dPx), dPy, 1);
                    }
                    await Task.Delay(100);
                    vncClient.SendMouseClick(X2, Y2, 1); // stop dragging
                    vncClient.SendMouseClick(X2, Y2, 1); // stop dragging

                    Console.WriteLine("after x:" + X2 + " y:" + Y2);
                }));
            }
            else
            {
                throw new Exception("wrong execute called!");
            }
        }
Example #2
0
 public virtual async Task Execute(IRfbClient vncClient)
 {
     if (Action == Command.Pause)
     {
         await Task.Delay(100);
     }
     else if (Action == Command.Home)
     {
         vncClient.SendMouseClick(0, 0, 4);
     }
 }
 public override Task Execute(IRfbClient vncClient)
 {
     if (Action == Command.Move)
     {
         return(Task.Run(() => vncClient.SendMouseClick(X, Y, 0)));
     }
     else if (Action == Command.Click)
     {
         return(Task.Run(() =>
         {
             vncClient.SendMouseClick(X, Y, 0);
             vncClient.SendMouseClick(X, Y, 1);
             vncClient.SendMouseClick(X, Y, 0);
         }));
     }
     else
     {
         throw new Exception("wrong execute called!");
     }
 }