Example #1
0
 public void SearchStatusChange(string message)
 {
     SearchStatusChanged?.Invoke(this, message);
 }
Example #2
0
        private void ReportStatus(OperationStatus status)
        {
            _status = status.Id;
            switch (status.Id)
            {
            case SearchStatus.NewFileSelected:
                SearchStatusInfo = string.Format("Selecting files. Total files selected {0}.", status.HandledItems);
                break;

            case SearchStatus.Grouping:
                SearchStatusInfo = string.Format("Groupping files by {0}. Handled {1} files from {2}.",
                                                 status.Stage, status.HandledItems, status.TotalItems);
                break;

            case SearchStatus.GroupingCompleted:
                SearchStatusInfo = string.Format("Grouping complete. Regrouped {0} duplicates into {1} groups.",
                                                 _duplicatesCollection.FilesCount, _duplicatesCollection.Count);
                break;

            case SearchStatus.ComparingStarted:
            case SearchStatus.Comparing:
                SearchStatusInfo = string.Format("Comparing files by {0}. Compared {1} files from {2}.",
                                                 status.Stage, status.HandledItems, status.TotalItems);
                break;

            case SearchStatus.Sorting:
                SearchStatusInfo = $"Sorting files by {status.Stage}.";
                break;

            case SearchStatus.SearchCompleted:
                SearchStatusInfo = string.Format("Search completed. Found {0} duplicates in {1} groups.",
                                                 _duplicatesCollection.FilesCount, _duplicatesCollection.Count);
                break;

            case SearchStatus.SearchCanceled:
                SearchStatusInfo = string.Format("Search canceled.");
                break;

            case SearchStatus.GroupingCanceled:
                SearchStatusInfo = string.Format("Grouping canceled.");
                break;

            case SearchStatus.ResultsCleared:
                SearchStatusInfo = string.Format("Search results cleared.");
                break;

            case SearchStatus.StartCancelOperation:
                SearchStatusInfo = string.Format("Canceling current operation.");
                break;

            case SearchStatus.Error:
                status.Message   = status.Message.Replace('\r', ' ');
                status.Message   = status.Message.Replace('\n', ' ');
                SearchStatusInfo = string.Format("Error: {0} Operation canceled.", status.Message);
                break;
            }
            SearchStatusChanged?.Invoke(this, status.Id);

            if (OperationCompleted)
            {
                _duplicatesCollection.Invalidate();
            }
        }