[GUI] Notify when all exports are done instead of each of them separately

This commit is contained in:
Oleksii Holub 2019-04-12 16:24:17 +03:00
parent 1325edb135
commit 26322da800

View file

@ -253,6 +253,7 @@ namespace DiscordChatExporter.Gui.ViewModels
var operations = ProgressManager.CreateOperations(dialog.Channels.Count); var operations = ProgressManager.CreateOperations(dialog.Channels.Count);
// Export channels // Export channels
var successfulExportCount = 0;
for (var i = 0; i < dialog.Channels.Count; i++) for (var i = 0; i < dialog.Channels.Count; i++)
{ {
// Get operation and channel // Get operation and channel
@ -281,8 +282,8 @@ namespace DiscordChatExporter.Gui.ViewModels
await _exportService.ExportChatLogAsync(chatLog, filePath, dialog.SelectedFormat, await _exportService.ExportChatLogAsync(chatLog, filePath, dialog.SelectedFormat,
dialog.PartitionLimit); dialog.PartitionLimit);
// Notify completion // Report successful export
Notifications.Enqueue($"Channel [{channel.Model.Name}] successfully exported"); successfulExportCount++;
} }
catch (HttpErrorStatusCodeException ex) when (ex.StatusCode == HttpStatusCode.Forbidden) catch (HttpErrorStatusCodeException ex) when (ex.StatusCode == HttpStatusCode.Forbidden)
{ {
@ -298,6 +299,9 @@ namespace DiscordChatExporter.Gui.ViewModels
operation.Dispose(); operation.Dispose();
} }
} }
// Notify of overall completion
Notifications.Enqueue($"Successfully exported {successfulExportCount} channel(s)");
} }
} }
} }