From 08da5d685bd3a0ece9766359bacb9b49a1502bbb Mon Sep 17 00:00:00 2001 From: Oleksii Holub Date: Mon, 25 Jun 2018 17:11:52 +0300 Subject: [PATCH] Prevent choosing invalid from/to dates --- DiscordChatExporter.Gui/ViewModels/ExportSetupViewModel.cs | 6 ++++++ DiscordChatExporter.Gui/Views/ExportSetupDialog.xaml | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/DiscordChatExporter.Gui/ViewModels/ExportSetupViewModel.cs b/DiscordChatExporter.Gui/ViewModels/ExportSetupViewModel.cs index 7bab525..12d80ed 100644 --- a/DiscordChatExporter.Gui/ViewModels/ExportSetupViewModel.cs +++ b/DiscordChatExporter.Gui/ViewModels/ExportSetupViewModel.cs @@ -93,6 +93,12 @@ namespace DiscordChatExporter.Gui.ViewModels // Save format _settingsService.LastExportFormat = SelectedFormat; + // Clamp 'from' and 'to' values + if (From > To) + From = To; + if (To < From) + To = From; + // Start export MessengerInstance.Send(new StartExportMessage(Channel, FilePath, SelectedFormat, From, To)); } diff --git a/DiscordChatExporter.Gui/Views/ExportSetupDialog.xaml b/DiscordChatExporter.Gui/Views/ExportSetupDialog.xaml index 5fb759c..e24f2ca 100644 --- a/DiscordChatExporter.Gui/Views/ExportSetupDialog.xaml +++ b/DiscordChatExporter.Gui/Views/ExportSetupDialog.xaml @@ -36,18 +36,22 @@