public void CancelDrop() { dropSourceAllowDrop = false; cancelDrop = true; outMan.Send(new ISInputData(ISInputCode.IS_KEYDOWN, (short)WindowsVirtualKey.Escape, 0)); Thread.Sleep(50); outMan.Send(new ISInputData(ISInputCode.IS_KEYUP, (short)WindowsVirtualKey.Escape, 0)); }
/// <summary> /// Occurs when the user drags an item over the the window. /// Here we use WindowsOutputManager to release the left mouse button /// so that the data is dropped, even if the input is currently being redirectd /// to another client. /// </summary> /// <param name="sender">This form</param> /// <param name="args"></param> private void WindowsDropForm_DragOver(object sender, System.Windows.Forms.DragEventArgs args) { if (!AllowDrop) { args.Effect = 0; return; } args.Effect = System.Windows.Forms.DragDropEffects.Copy; outM.Send(new InputshareLib.Input.ISInputData(InputshareLib.Input.ISInputCode.IS_MOUSELUP, 0, 0)); }
private void DoDragDrop(ClipboardDataBase data) { InputshareDataObject nativeObject = null; try { nativeObject = ClipboardTranslatorWindows.ConvertToWindows(data); reportedSuccess = false; nativeObject.SetData("InputshareData", new bool()); dropQueue.Enqueue(nativeObject); nativeObject.DropComplete += NativeObject_DropComplete; nativeObject.DropSuccess += NativeObject_DropSuccess; } catch (Exception ex) { ISLogger.Write("Could not start drag drop operation: " + ex.Message); return; } this.Show(); this.BringToFront(); this.TopMost = true; GetCurrentCursorMonitorSize(out Size mSize, out Point mPos); this.SetDesktopLocation((int)mPos.X, (int)mPos.Y); this.Size = mSize; outMan.Send(new InputshareLib.Input.ISInputData(InputshareLib.Input.ISInputCode.IS_MOUSELDOWN, 0, 0)); outMan.Send(new InputshareLib.Input.ISInputData(InputshareLib.Input.ISInputCode.IS_MOUSERUP, 0, 0)); Task.Run(() => { Thread.Sleep(300); this.Invoke(new Action(() => { if (!registeredDrop) { DoDragDrop(data); } })); }); }
private void ThreadLoop() { while (!cancelToken.IsCancellationRequested) { ISInputData input = outputQueue.Take(); if (SwitchThreadDesktop) { WinDesktop.SwitchThreadToInputDesktop(); SwitchThreadDesktop = false; } outManager.Send(input); } ISLogger.Write("Exited output thread loop"); }
private static void IClient_InputReceived(object sender, InputshareLib.Input.ISInputData input) { outputDeskThread.Invoke(() => { outMan.Send(input); }); }