Replace the date format option with a locale option (#1130)

This commit is contained in:
Oleksii Holub
2023-09-07 14:34:08 +03:00
committed by GitHub
parent 53b11d6c49
commit 59344cedbe
22 changed files with 288 additions and 273 deletions

View File

@@ -78,6 +78,11 @@ public class DashboardViewModel : PropertyChangedBase
// due to the channels being asynchronously loaded.
AvailableChannels = null;
SelectedChannels = null;
// Pull channels for the selected guild
// (ideally this should be called inside `PullGuilds()`,
// but Stylet doesn't support async commands)
PullChannels();
}
);
}
@@ -88,14 +93,14 @@ public class DashboardViewModel : PropertyChangedBase
Token = _settingsService.LastToken;
}
public async ValueTask ShowSettingsAsync() =>
public async void ShowSettings() =>
await _dialogManager.ShowDialogAsync(_viewModelFactory.CreateSettingsViewModel());
public void ShowHelp() => ProcessEx.StartShellExecute(App.DocumentationUrl);
public bool CanPullGuildsAsync => !IsBusy && !string.IsNullOrWhiteSpace(Token);
public bool CanPullGuilds => !IsBusy && !string.IsNullOrWhiteSpace(Token);
public async ValueTask PullGuildsAsync()
public async void PullGuilds()
{
IsBusy = true;
var progress = _progressMuxer.CreateInput();
@@ -118,9 +123,6 @@ public class DashboardViewModel : PropertyChangedBase
AvailableGuilds = guilds;
SelectedGuild = guilds.FirstOrDefault();
// Pull channels for the selected guild
await PullChannelsAsync();
}
catch (DiscordChatExporterException ex) when (!ex.IsFatal)
{
@@ -142,10 +144,9 @@ public class DashboardViewModel : PropertyChangedBase
}
}
public bool CanPullChannelsAsync =>
!IsBusy && _discord is not null && SelectedGuild is not null;
public bool CanPullChannels => !IsBusy && _discord is not null && SelectedGuild is not null;
public async ValueTask PullChannelsAsync()
public async void PullChannels()
{
IsBusy = true;
var progress = _progressMuxer.CreateInput();
@@ -206,13 +207,13 @@ public class DashboardViewModel : PropertyChangedBase
}
}
public bool CanExportAsync =>
public bool CanExport =>
!IsBusy
&& _discord is not null
&& SelectedGuild is not null
&& SelectedChannels?.Any() is true;
public async ValueTask ExportAsync()
public async void Export()
{
IsBusy = true;
@@ -267,7 +268,8 @@ public class DashboardViewModel : PropertyChangedBase
dialog.ShouldFormatMarkdown,
dialog.ShouldDownloadAssets,
dialog.ShouldReuseAssets,
_settingsService.DateFormat
_settingsService.Locale,
_settingsService.IsUtcNormalizationEnabled
);
await exporter.ExportChannelAsync(request, progress, cancellationToken);