protected override bool PrepareOperation()
        {
            if (drive.DataDrive.Deletes.Count == 0)
            return false;

              if (drive.DataDrive.Deletes.Count > MAX_UNDELETE_FILES) {
            MessageWindow.Show(viewModel.Owner, "Can't undelete", "There are too many files missing from this drive to perform an Undelete.\n\n" +
              "Try using Recover instead to recover the entire drive.", MessageWindowIcon.Error, MessageWindowButton.OK);
            return false;
              }

              List<string> files = new List<string>();
              foreach (FileRecord r in drive.DataDrive.Deletes)
            files.Add(r.FullPath);

              UndeleteWindowViewModel vm = new UndeleteWindowViewModel(files);

              UndeleteWindow window = new UndeleteWindow();
              window.Owner = viewModel.Owner;
              window.DataContext = vm;
              bool? dialogResult = window.ShowDialog();

              if (dialogResult == null || dialogResult == false)
            return false;

              filesToRestore = vm.SelectedFiles;

              return true;
        }
Beispiel #2
0
        protected override bool PrepareOperation()
        {
            if (drive.DataDrive.Deletes.Count == 0)
            {
                return(false);
            }

            if (drive.DataDrive.Deletes.Count > MAX_UNDELETE_FILES)
            {
                MessageWindow.Show(viewModel.Owner, "Can't undelete", "There are too many files missing from this drive to perform an Undelete.\n\n" +
                                   "Try using Recover instead to recover the entire drive.", MessageWindowIcon.Error, MessageWindowButton.OK);
                return(false);
            }

            List <string> files = new List <string>();

            foreach (FileRecord r in drive.DataDrive.Deletes)
            {
                files.Add(r.FullPath);
            }

            UndeleteWindowViewModel vm = new UndeleteWindowViewModel(files);

            UndeleteWindow window = new UndeleteWindow();

            window.Owner       = viewModel.Owner;
            window.DataContext = vm;
            bool?dialogResult = window.ShowDialog();

            if (dialogResult == null || dialogResult == false)
            {
                return(false);
            }

            filesToRestore = vm.SelectedFiles;

            return(true);
        }