This commit is contained in:
Tyrrrz
2021-04-16 23:09:08 +03:00
parent 2fea455c64
commit 511af1e35c
38 changed files with 173 additions and 377 deletions

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using DiscordChatExporter.Gui.Internal;
using DiscordChatExporter.Core.Discord;
using DiscordChatExporter.Core.Discord.Data;
using DiscordChatExporter.Core.Exporting;
@@ -47,12 +46,7 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs
public DateTimeOffset? Before => BeforeDate?.Add(BeforeTime ?? TimeSpan.Zero);
public IReadOnlyList<PartitionFormat> AvailablePartitionFormats =>
Enum.GetValues(typeof(PartitionFormat)).Cast<PartitionFormat>().ToArray();
public PartitionFormat SelectedPartitionFormat { get; set; }
public int? PartitionLimit { get; set; }
public string? PartitionLimitValue { get; set; }
public bool ShouldDownloadMedia { get; set; }
@@ -61,7 +55,7 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs
public bool IsAdvancedSectionDisplayedByDefault =>
After != default ||
Before != default ||
PartitionLimit != default ||
!string.IsNullOrWhiteSpace(PartitionLimitValue) ||
ShouldDownloadMedia != default;
public ExportSetupViewModel(DialogManager dialogManager, SettingsService settingsService)
@@ -71,18 +65,15 @@ namespace DiscordChatExporter.Gui.ViewModels.Dialogs
// Persist preferences
SelectedFormat = _settingsService.LastExportFormat;
PartitionLimit = _settingsService.LastPartitionLimit;
PartitionLimitValue = _settingsService.LastPartitionLimitValue;
ShouldDownloadMedia = _settingsService.LastShouldDownloadMedia;
SelectedPartitionFormat = _settingsService.LastPartitionFormat;
}
public void Confirm()
{
// Persist preferences
_settingsService.LastExportFormat = SelectedFormat;
_settingsService.LastPartitionLimit = PartitionLimit;
_settingsService.LastPartitionFormat = SelectedPartitionFormat;
_settingsService.LastPartitionLimitValue = PartitionLimitValue;
_settingsService.LastShouldDownloadMedia = ShouldDownloadMedia;
// If single channel - prompt file path