/// <summary> /// Handles whenever the sharer moves his mouse and sends his mouse data to the server. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MouseMonitor_MouseMovedWithinSharedWindow(object sender, MouseMonitor.MouseArgs e) { CollabPacket.Packet mouseDataPacket = new CollabPacket.Packet { MousePacket = new CollabPacket.MousePacket { X = e.X, Y = e.Y }, User = Globals.User, ShareID = ShareID, Message = "MOUSE_MOVE" }; Globals.Client.WriteData(CollabPacket.ClassSerializer.SerializeClass(mouseDataPacket)); }
public void SharedWindowChanged(object sender, MouseMonitor.WindowLocationArgs e) { if (InvokeRequired) { Invoke(new Action(() => { Location = new Point(e.X, e.Y); Width = e.Width; Height = e.Height; Refresh(); })); } else { Location = new Point(e.X, e.Y); Width = e.Width; Height = e.Height; Refresh(); } }
/// <summary> /// This function is called by the Sharer whenever he wants to start a share session on the server. /// </summary> /// <param name="windowHandle"></param> public void StartShareSession(Client.ShareEventArgs e) { // Start mousemonitor MouseMonitor = new MouseMonitor(WindowHandle, 10); MouseMonitor.MouseMovedWithinSharedWindow += MouseMonitor_MouseMovedWithinSharedWindow; MouseMonitor.Start(); //// Start Overlay //Thread mThread = new Thread(() => // { // MouseWindow = new MouseDisplay(); // MouseMonitor.SharedWindowChanged += MouseWindow.SharedWindowChanged; // MouseWindow.Add(e.Packet.User.UserID, // e.Packet.User.FirstName + " " + e.Packet.User.LastName.Substring(0, 1)); // MouseWindow.Show(); // while (true) // { // Thread.Sleep(9999999); // } // }); //mThread.SetApartmentState(ApartmentState.STA); //mThread.Start(); ////mThread.Join(); _dispatcher.BeginInvoke(new Action(() => { MouseWindow = new MouseDisplay(); MouseMonitor.SharedWindowChanged += MouseWindow.SharedWindowChanged; MouseWindow.Add(e.Packet.User.UserID, e.Packet.User.FirstName + " " + e.Packet.User.LastName.Substring(0, 1)); MouseWindow.Show(); })); // Start capure timer StartShare(); }