mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2025-05-23 03:06:53 -04:00
Prevent choosing invalid from/to dates
This commit is contained in:
parent
c2cebe99e3
commit
08da5d685b
2 changed files with 10 additions and 0 deletions
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -36,18 +36,22 @@
|
|||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<DatePicker
|
||||
x:Name="FromDatePicker"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="16,20,8,8"
|
||||
materialDesign:HintAssist.Hint="From (optional)"
|
||||
materialDesign:HintAssist.IsFloating="True"
|
||||
DisplayDateEnd="{Binding SelectedDate, ElementName=ToDatePicker}"
|
||||
SelectedDate="{Binding From}" />
|
||||
<DatePicker
|
||||
x:Name="ToDatePicker"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="8,20,16,8"
|
||||
materialDesign:HintAssist.Hint="To (optional)"
|
||||
materialDesign:HintAssist.IsFloating="True"
|
||||
DisplayDateStart="{Binding SelectedDate, ElementName=FromDatePicker}"
|
||||
SelectedDate="{Binding To}" />
|
||||
</Grid>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue