示例#1
0
        /// <summary>
        /// Starts the file copy process using the source and destination
        /// directories given by sourcePath and destinationPath.
        /// </summary>
        /// <param name="sourcePath">Path to source directory</param>
        /// <param name="destinationPath">Path to destination directory</param>
        public void Start(string sourcePath, string destinationPath)
        {
            this._view.ClearErrorMessage();
            try
            {
                sourcePath = Path.GetFullPath(sourcePath);
            } catch (Exception ex)
            {
                this._view.DisplayErrorMessage("Source path is invalid");
                return;
            }
            try
            {
                destinationPath = Path.GetFullPath(destinationPath);
            } catch (Exception ex)
            {
                this._view.DisplayErrorMessage("Destination path is invalid");
                return;
            }

            this.sourcePath      = sourcePath;
            this.destinationPath = destinationPath;

            this._view.DisplayMessage("Finding files...");
            this._view.FindingFiles();

            numberOfFiles = FileManipulator.DeepFileCount(sourcePath);

            this._view.DisplayMessage($"Copying {numberOfFiles} items");
            this._view.CopyingFiles(numberOfFiles);

            Thread copyThread = new Thread(StartFileCopy);

            copyThread.Start();
        }