예제 #1
0
 /// <summary>
 /// Handle a non success
 /// </summary>
 /// <param name="successDescriptor"></param>
 /// <param name="fileSize"></param>
 /// <returns></returns>
 private FileMoveProgressArgs HandleFailed(SuccessDescriptor successDescriptor, long fileSize)
 {
     if (successDescriptor.ErrorCode == CANCELLED_ERROR_CODE) //ie it failed because the user cancelled the execution we dont to thrown an exception
     {
         return(new FileMoveProgressArgs(fileSize, 0));
     }
     else
     {
         throw new Win32Exception(successDescriptor.ErrorCode);
     }
 }
예제 #2
0
        /// <summary>
        /// Handles the the returned boolean of the win32 method, along with the processing of the LastWin32 error if it failed
        /// </summary>
        /// <param name="sourcePath"></param>
        /// <param name="sucessDescriptor"></param>
        private void HandleResult(string sourcePath, SuccessDescriptor sucessDescriptor)
        {
            FileMoveProgressArgs moveEventArgs;

            if (!sucessDescriptor.IsSuccess)
            {
                moveEventArgs = HandleFailed(sucessDescriptor, _totalFileSize);
            }
            else
            {
                //doing this as small files, never get called back from the Win32 method and hence the progress is never updated, so this is make sure 100% is returned once it is complete
                moveEventArgs = new FileMoveProgressArgs(_totalFileSize, _totalFileSize);
            }
            ProgressCallback(moveEventArgs);
        }