示例#1
0
        private void StartCopy2()
        {
            // if last time stopped cancel set initials it again
            CopyFile.CancelStop();

            copyFileProgress              cpProgress    = new copyFileProgress(ProgressShowForSingleFile);
            CopyFileFinishedCallback      cpFinished    = new CopyFileFinishedCallback(CopySingleFileCompleted);
            TrasferedSizeDelegate         tsTransfer    = new TrasferedSizeDelegate(CalculateTotalTransfered);
            CopyAllFinishedCallback       cpFinishedAll = new CopyAllFinishedCallback(FinishedCopyingAllFiles);
            SingleFileCopyStartedDelegate sfCopyd       = new SingleFileCopyStartedDelegate(CopySingleFileStarted);

            foreach (string fileName in SelectedFiles)
            {
                CopyFile cp = new CopyFile(fileName, GetDestinationFileName(fileName), cpFinished, cpProgress, tsTransfer);

                if (ignoreCurrentFile == true)
                {
                    // Reset for next use
                    ignoreCurrentFile = false;
                    //
                    continue;
                }

                sfCopyd(new CopyCurrentFileInfo
                {
                    oldFile           = fileName,
                    newFile           = GetDestinationFileName(fileName),
                    CurrentFileNumber = SelectedFiles.IndexOf(fileName) + 1,
                    TotalFileNumber   = SelectedFiles.Count
                });

                cp.StartCopyAsync2();
            }
            cpFinishedAll();
        }
示例#2
0
        private void StartCut2()
        {
            // if last time stopped cancel set initials it again
            CopyFile.CancelStop();

            copyFileProgress              cpProgress    = new copyFileProgress(ProgressShowForSingleFile);
            CopyFileFinishedCallback      cpFinished    = new CopyFileFinishedCallback(CopySingleFileCompleted);
            TrasferedSizeDelegate         tsTransfer    = new TrasferedSizeDelegate(CalculateTotalTransfered);
            CopyAllFinishedCallback       cpFinishedAll = new CopyAllFinishedCallback(FinishedCopyingAllFiles);
            SingleFileCopyStartedDelegate sfCopyd       = new SingleFileCopyStartedDelegate(CopySingleFileStarted);

            foreach (string fileName in SelectedFiles)
            {
                CutFile cu = new CutFile(fileName, GetDestinationFileName(fileName), cpFinished, cpProgress, tsTransfer);

                if (ignoreCurrentFile == true)
                {
                    // Reset for next use
                    ignoreCurrentFile = false;
                    //
                    continue;
                }

                sfCopyd(new CopyCurrentFileInfo
                {
                    newFile           = fileName,
                    oldFile           = GetDestinationFileName(fileName),
                    CurrentFileNumber = SelectedFiles.IndexOf(fileName) + 1,
                    TotalFileNumber   = SelectedFiles.Count
                });

                cu.StartCutAsync2();
            }
            cpFinishedAll();

            // file watcher is disabled durring cutting operation
            // when cutting is done,it should be enabled again
            _enable_watcher();
            //
        }