Пример #1
0
        private async void BeginReceivedOperation(NetworkSocket.DragDropDataReceivedArgs args)
        {
            //Check if the received operation has previously been received
            if (CurrentOperation?.OperationId == args.OperationId)
            {
                ddManager.DoDragDrop(CurrentOperation.Data, args.OperationId);
                return;
            }

            if (CurrentOperation != null && !previousOperations.ContainsKey(CurrentOperation.OperationId))
            {
                previousOperations.Add(CurrentOperation.OperationId, CurrentOperation);
            }


            ClipboardDataBase cbData = ClipboardDataBase.FromBytes(args.RawData);


            //We need to setup the virtual files if this is a file drop
            if (cbData is ClipboardVirtualFileData cbFiles)
            {
                //Get an access token for the files from the server
                Guid token;
                try
                {
                    token = await Server.RequestFileTokenAsync(args.OperationId);
                }
                catch (Exception ex)
                {
                    ISLogger.Write("LocalDragDropController: Failed to get access token for dragdrop operation: " + ex.Message);
                    return;
                }


                for (int i = 0; i < cbFiles.AllFiles.Count; i++)
                {
                    cbFiles.AllFiles[i].RemoteAccessToken = token;
                    cbFiles.AllFiles[i].ReadComplete     += VirtualFile_ReadComplete;
                    cbFiles.AllFiles[i].ReadDelegate      = VirtualFile_RequestDataAsync;
                    cbFiles.AllFiles[i].FileOperationId   = args.OperationId;
                }
            }

            CurrentOperation = new DragDropOperation(args.OperationId, cbData);
            ddManager.DoDragDrop(cbData, args.OperationId);
        }
Пример #2
0
        private void BeginReceivedOperation(NetworkSocket.DragDropDataReceivedArgs args)
        {
            if (!DragDropEnabled)
            {
                server.NotifyDragDropSuccess(false);
                return;
            }

            //Check if the received operation has previously been received
            if (CurrentOperation?.OperationGuid == args.OperationId)
            {
                ddManager.DoDragDrop(CurrentOperation.Data);
                return;
            }

            ClipboardDataBase cbData = ClipboardDataBase.FromBytes(args.RawData);

            cbData.OperationId = args.OperationId;

            //We need to setup the virtual files if this is a file drop
            if (cbData is ClipboardVirtualFileData cbFiles)
            {
                cbFiles.RequestPartMethod  = server.RequestReadStreamAsync;
                cbFiles.RequestTokenMethod = server.RequestFileTokenAsync;

                ISLogger.Write("Copied files");

                foreach (var file in cbFiles.AllFiles)
                {
                    ISLogger.Write(file.FullPath);
                }
            }

            CurrentOperation = new ClientDataOperation(cbData, args.OperationId);
            ddManager.DoDragDrop(cbData);
        }
Пример #3
0
        public void Client_DataDropped(object sender, NetworkSocket.DragDropDataReceivedArgs args)
        {
            ISServerSocket client = sender as ISServerSocket;

            BeginOperation(client, ClipboardDataBase.FromBytes(args.RawData), args.OperationId);
        }
Пример #4
0
 internal void Socket_DragDropReceived(object sender, NetworkSocket.DragDropDataReceivedArgs args)
 {
     BeginReceivedOperation(args);
 }