Esempio n. 1
0
 private void dispatcherTimer_Tick(object sender, EventArgs r)
 {
     MouseOperations.MousePoint a = MouseOperations.GetCursorPosition();
     if (x != a.X || y != a.Y)
     {
         x = a.X;
         y = a.Y;
         if (isHotkeyOn)
         {
             send("m$" + x + "," + y);
         }
     }
 }
Esempio n. 2
0
        public void receive(string type, string data)
        {
            Console.WriteLine("GET:   " + type + "$" + data);

            if (type == "m")
            {
                try
                {
                    string[] result = data.Split(',');
                    int      x1     = Int32.Parse(result[0]);
                    int      y1     = Int32.Parse(result[1]);
                    MouseOperations.SetCursorPosition(x1, y1);
                }
                catch (Exception)
                {
                }
            }

            else if (type == "c")
            {
                string[] result = data.Split(',');
                int      x1     = Int32.Parse(result[0]);
                int      y1     = Int32.Parse(result[1]);
                MouseOperations.SetCursorPosition(x1, y1);
                MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.LeftDown);
                MouseOperations.MouseEvent(MouseOperations.MouseEventFlags.LeftUp);
            }

            else if (type == "t")
            {
                if (srvorclt == true)
                {
                    messagetextBlock.Text += "\nServer: " + data;
                }
                else
                {
                    messagetextBlock.Text += "\nClient: " + data;
                }
            }
        }