private FileExistDialog.FileExistActionEnum GetDecisionFromMessageBox(StatusDetail statusDetail, string targetPath)
 {
     using (var msgBox = new FileExistDialog(statusDetail.SourceFile, targetPath))
     {
         msgBox.ShowDialog();
         return(msgBox.SelectedAction);
     }
 }
Example #2
0
        /// <summary>
        /// Executes the move operation
        /// </summary>
        protected override void Execute()
        {
            double progressMeter = 1.0 / Items.Length;

            Progress = 0;

            foreach (IDirectoryViewItem item in Items)
            {
                if (IsCanceled)
                {
                    break;
                }

                CurrentItem   = item;
                OperationName = "Przenoszenie " + CurrentItem.Name;

                //check if file exist in destination directory
                if (DestFileSystem.CheckIfObjectExist(PathExt.Combine(DestinationPath, item.Name, DestFileSystem.IsWindowsFileSystem)) && !overrideAll)
                {
                    var dialog = new FileExistDialog(item, DestinationPath);
                    dialog.ShowModalDialog();

                    if (dialog.Result == FileExistDalogResult.Override)
                    {
                        CommenceMove();
                        Progress += progressMeter;
                    }
                    else if (dialog.Result == FileExistDalogResult.OverrideAll)
                    {
                        overrideAll = true;
                        CommenceMove();
                        Progress += progressMeter;
                    }
                    else if (dialog.Result == FileExistDalogResult.CancelOperation)
                    {
                        IsCanceled = true;
                    }
                    //else if(result==FileExistDalogResult.DontOverride) - easy go to next item
                }
                else
                {
                    CommenceMove();
                    Progress += progressMeter;
                }
            }

            OperationName = Items.ContainsOneElement() ? "Przenoszenie " + Items.First().Name : string.Format("Przenoszenie {0} obiektów", Items.Length);
            if (!IsCanceled)
            {
                OnFinished();
            }
            else
            {
                Rollback();
            }
        }