void ChooseFuzzyMatches(LibraryManager library, MapResult result) { if (result != null && result.FuzzyMatches.Count() > 0) { TaskUtil.PerformForegroundTask(this, library.ChooseFuzzyMatchesAsync(this, result.FuzzyMatches), fuzzyResult => ShowSummary(result, fuzzyResult), error => MessageBox.Show("An error occured when updating the library." + Environment.NewLine + Environment.NewLine + "Details : " + error.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)); } }
void ShowSummary(MapResult mapResult, ChooseFuzzyMatchesResult fuzzyResult) { var totalUpdated = mapResult.Updated + fuzzyResult.Updated; var totalUpToDate = mapResult.AlreadyUpToDate + fuzzyResult.AlreadyUpToDate; var totalFailed = mapResult.UpdateFailed + fuzzyResult.UpdateFailed; var totalSkipped = totalFailed + mapResult.NotFound; if (totalFailed > 0) new ErrorReporter(mapResult.Errors.Concat(fuzzyResult.Errors)).ShowDialog(this); MessageBox.Show(totalUpdated + " entries updated, " + totalUpToDate + " were already up to date, " + totalSkipped + " were skipped.", "Mapping complete", MessageBoxButtons.OK, MessageBoxIcon.Information); }