예제 #1
0
        private async void DeleteDeltaFiles(object arg)
        {
            _deletionBusy = true;

            Progress <DeletionProgressReportModel> progress = new Progress <DeletionProgressReportModel>();

            progress.ProgressChanged += ProgressReportedEventHandler;

            MyDeletedFilesNo   = 0;
            MyDeletionProgress = 0;
            string msg = "completed";

            _cts = new CancellationTokenSource();
            try
            {
                if (RSSettingsModel.Instance.DeletePromptSetting)
                {
                    await DeleteDeltaFilesAsync(progress, _cts.Token);
                }
                else
                {
                    await QuickDeleteDeltaFilesAsync(progress, _cts.Token);
                }
            }
            catch (OperationCanceledException)
            {
                msg = "cancelled";
            }
            _cts.Dispose();

            if (RSSettingsModel.Instance.DeletePromptSetting == false)
            {
                // We are using quick parallel delete method (which may have been cancelled) - remove actually deleted items 'manually', when the above loop finishes
                foreach (var fd in SessionDeletedFiles)
                {
                    MyDeltaFiles.Remove(fd);
                    QualifiedRawNo--;
                }
                MyDeltaFilesView.Refresh();

                SessionDeletedFiles.Clear();

                OnPropertyRaised("MyDeltaFilesNo");
                OnPropertyRaised("MyRejectionRatio");
            }
            // We have done what we could, now
            // Fire the FilesDeleted Event so that the Main Window can update its raw list view, and
            // if the confirmation option is set, inform the user about the outcome of deletion.
            FilesDeletedEvent();
            if (RSSettingsModel.Instance.DeletePromptSetting)
            {
                WWMessageBox.Show($"Deletion { msg }.\nDeleted { MyDeletedFilesNo } file(s).", "Information", CustomMessageBoxButton.OK, MessageBoxImage.Information);
            }

            _deletionBusy = false;
            return;
        }
예제 #2
0
        private void GetFolderListing()
        {
            if (!Directory.Exists(FolderPath))
            {
                // Don't throw any exceptions, just inform the user and fallback to default folder, so he can change it later

                // This sometimes is called at startup, before MainWindow is created,
                // For this occasion, App.xaml.cs needs to modify ShutdownMode and MainWindow Application properties.

                WWMessageBox.Show($"GetFolderListing(): Folder does not exist:\n{ FolderPath }\nChanging to default...", "RAW Sync v. 3.0: Warning", CustomMessageBoxButton.OK, MessageBoxImage.Warning);
                FolderPath = _folder; // Fallback to default
            }

            string[] FileEntries = Directory.GetFiles(FolderPath);

            foreach (string s in FileEntries)
            {
                FileDescriptorModel fd = new FileDescriptorModel();
                fd.FilePath = s;
                FileList.Add(fd);
                fd.Id = FileList.Count;
            }
            return;
        }
예제 #3
0
 private void ProgramHelp(object arg)
 {
     WWMessageBox.Show("Raw Sync 3.0:\n\nSafely delete rejected RAW files,\nbased on matching the list of Processed files.\n\n© 2020 by Wojtek Wasiukiewicz.", "Help", CustomMessageBoxButton.OK, MessageBoxImage.Information);
 }