Ejemplo n.º 1
0
        /// <summary>
        /// Occurs when a user drags a file onto the window.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        private void WindowsDropForm_DragDrop(object sender, System.Windows.Forms.DragEventArgs args)
        {
            AllowDrop = false;
            this.Hide();
            this.Visible = false;
            this.Width   = 0;
            this.Height  = 0;
            this.SetDesktopLocation(0, 0);

            //We need to make sure that we don't send the dragdrop operation directly back to the server
            bool isInputshareDrop = false;

            foreach (var format in args.Data.GetFormats())
            {
                if (format.Contains("Inputshare"))
                {
                    isInputshareDrop = true;
                }
            }

            if (isInputshareDrop)
            {
                InputshareDataDropped = true;
                return;
            }

            args.Effect = System.Windows.Forms.DragDropEffects.Copy;
            //TODO - Decide whether to copy or move files/image/text

            /*
             * if (Convert.ToBoolean(GetKeyState(Keys.Control) & 0x8000))
             * {
             *  ISLogger.Write("dragdrop mode: Copy");
             *  args.Effect = System.Windows.Forms.DragDropEffects.Copy;
             * }
             * else
             * {
             *  ISLogger.Write("dragdrop mode: Move");
             *  args.Effect = System.Windows.Forms.DragDropEffects.Move;
             * }*/


            DataDropped?.Invoke(this, args.Data);
        }
Ejemplo n.º 2
0
 protected override void ProcessMessage(IpcMessageType type, byte[] data)
 {
     if (type == IpcMessageType.AnonIpcClipboardData)
     {
         ClipboardDataReceived?.Invoke(this, new AnonIpcClipboardDataMessage(data).Data);
     }
     else if (type == IpcMessageType.AnonIpcEdgeHit)
     {
         EdgeHit?.Invoke(this, new AnonIpcEdgeHitMessage(data).HitEdge);
     }
     else if (type == IpcMessageType.AnonIpcDisplayConfigReply)
     {
         DisplayConfigUpdated?.Invoke(this, new AnonIpcDisplayConfigMessage(data).Config);
     }
     else if (type == IpcMessageType.AnonIpcLMouseStateReply)
     {
         LeftMouseStateUpdated?.Invoke(this, new AnonIpcLMouseStateMessage(data).LeftMouseState);
     }
     else if (type == IpcMessageType.AnonIpcDoDragDrop)
     {
         DataDropped?.Invoke(this, new AnonIpcDoDragDropMessage(data).DropData);
     }
     else if (type == IpcMessageType.AnonIpcDragDropCancelled)
     {
         DragDropCancelled?.Invoke(this, null);
     }
     else if (type == IpcMessageType.AnonIpcDragDropSuccess)
     {
         DragDropSuccess?.Invoke(this, null);
     }
     else if (type == IpcMessageType.AnonIpcDragDropComplete)
     {
         DragDropComplete?.Invoke(this, null);
     }
     else if (type == IpcMessageType.AnonIpcStreamReadRequest)
     {
         HandleReadStreamRequest(new AnonIpcReadStreamRequestMessage(data));
     }
     else if (type == IpcMessageType.AnonIpcRequestFileToken)
     {
         HandleTokenRequest(new AnonIpcRequestFileTokenMessage(data));
     }
 }
Ejemplo n.º 3
0
 private void DropHost_HandleUpdated(object sender, EventArgs e)
 {
     clipboardHost.host.LeftMouseStateUpdated += (object s, bool state) => { LeftMouseState = state; };
     clipboardHost.host.DataDropped           += (object s, ClipboardDataBase data) => { DataDropped?.Invoke(this, data); };
     clipboardHost.host.DragDropCancelled     += (object s, EventArgs _) => { DragDropCancelled?.Invoke(this, null); };
     clipboardHost.host.DragDropSuccess       += (object s, EventArgs _) => { DragDropSuccess?.Invoke(this, null); };
     clipboardHost.host.RequestedReadStream   += Host_RequestedReadStream;
     clipboardHost.host.RequestedFileToken    += Host_RequestedFileToken;
 }
Ejemplo n.º 4
0
 public ServiceDragDropManager(IpcHandle hostDragDrop)
 {
     clipboardHost = hostDragDrop;
     clipboardHost.HandleUpdated += DropHost_HandleUpdated;
     clipboardHost.host.LeftMouseStateUpdated += (object s, bool state) => { LeftMouseState = state; };
     clipboardHost.host.DataDropped           += (object s, ClipboardDataBase data) => { DataDropped?.Invoke(this, data); };
     clipboardHost.host.DragDropCancelled     += (object s, EventArgs _) => { DragDropCancelled?.Invoke(this, null); };;
     clipboardHost.host.DragDropSuccess       += (object s, EventArgs _) => { DragDropSuccess?.Invoke(this, null); };
     clipboardHost.host.RequestedReadStream   += Host_RequestedReadStream;
     clipboardHost.host.RequestedFileToken    += Host_RequestedFileToken;
 }