This commit is contained in:
Tyrrrz
2023-05-20 07:09:19 +03:00
parent 03c5c1bc5e
commit 31c7ae9312
50 changed files with 181 additions and 198 deletions

View File

@@ -17,8 +17,8 @@ public class Bootstrapper : Bootstrapper<RootViewModel>
{
base.OnStart();
// Set default theme
// (preferred theme will be set later, once the settings are loaded)
// Set the default theme.
// Preferred theme will be set later, once the settings are loaded.
App.SetLightTheme();
}
@@ -26,10 +26,7 @@ public class Bootstrapper : Bootstrapper<RootViewModel>
{
base.ConfigureIoC(builder);
// Bind settings as singleton
builder.Bind<SettingsService>().ToSelf().InSingletonScope();
// Bind view model factory
builder.Bind<IViewModelFactory>().ToAbstractFactory();
}

View File

@@ -45,7 +45,7 @@ public partial class SettingsService : SettingsBase
public override void Save()
{
// Clear token if it's not supposed to be persisted
// Clear the token if it's not supposed to be persisted
if (!IsTokenPersisted)
LastToken = null;

View File

@@ -6,13 +6,15 @@ internal static class ProcessEx
{
public static void StartShellExecute(string path)
{
var startInfo = new ProcessStartInfo(path)
using var process = new Process
{
UseShellExecute = true
StartInfo = new ProcessStartInfo
{
FileName = path,
UseShellExecute = true
}
};
using (Process.Start(startInfo))
{
}
process.Start();
}
}

View File

@@ -156,14 +156,11 @@ public class DashboardViewModel : PropertyChangedBase
var exporter = new ChannelExporter(_discord);
var channelProgressPairs = dialog
.Channels!
.Select(c => new
{
Channel = c,
Progress = _progressMuxer.CreateInput()
})
.ToArray();
var channelProgressPairs = dialog.Channels!.Select(c => new
{
Channel = c,
Progress = _progressMuxer.CreateInput()
}).ToArray();
var successfulExportCount = 0;
@@ -213,7 +210,7 @@ public class DashboardViewModel : PropertyChangedBase
}
);
// Notify of overall completion
// Notify of the overall completion
if (successfulExportCount > 0)
{
_eventAggregator.Publish(

View File

@@ -25,7 +25,7 @@ public class DialogManager : IDisposable
void OnDialogOpened(object? openSender, DialogOpenedEventArgs openArgs)
{
void OnScreenClosed(object? closeSender, EventArgs args)
void OnScreenClosed(object? closeSender, EventArgs closeArgs)
{
try
{

View File

@@ -1,8 +1,3 @@
namespace DiscordChatExporter.Gui.ViewModels.Messages;
public class NotificationMessage
{
public string Text { get; }
public NotificationMessage(string text) => Text = text;
}
public record NotificationMessage(string Text);

View File

@@ -62,9 +62,7 @@ public class RootViewModel : Screen, IHandle<NotificationMessage>, IDisposable
_settingsService.Save();
if (await _dialogManager.ShowDialogAsync(dialog) == true)
{
ProcessEx.StartShellExecute("https://tyrrrz.me/ukraine?source=discordchatexporter");
}
}
private async ValueTask CheckForUpdatesAsync()
@@ -106,7 +104,7 @@ public class RootViewModel : Screen, IHandle<NotificationMessage>, IDisposable
_settingsService.Load();
// Sync theme with settings
// Sync the theme with settings
if (_settingsService.IsDarkModeEnabled)
{
App.SetDarkTheme();
@@ -116,7 +114,7 @@ public class RootViewModel : Screen, IHandle<NotificationMessage>, IDisposable
App.SetLightTheme();
}
// App has just been updated, display changelog
// App has just been updated, display the changelog
if (_settingsService.LastAppVersion is not null && _settingsService.LastAppVersion != App.Version)
{
Notifications.Enqueue(
@@ -137,8 +135,7 @@ public class RootViewModel : Screen, IHandle<NotificationMessage>, IDisposable
_updateService.FinalizeUpdate(false);
}
public void Handle(NotificationMessage message) =>
Notifications.Enqueue(message.Text);
public void Handle(NotificationMessage message) => Notifications.Enqueue(message.Text);
public void Dispose() => Notifications.Dispose();
}

View File

@@ -221,7 +221,7 @@
materialDesign:HintAssist.IsFloating="True"
Style="{DynamicResource MaterialDesignOutlinedTextBox}"
Text="{Binding PartitionLimitValue}"
ToolTip="Split output into partitions, each limited to this number of messages (e.g. '100') or file size (e.g. '10mb')" />
ToolTip="Split the output into partitions, each limited to the specified number of messages (e.g. '100') or file size (e.g. '10mb')" />
<!-- Filtering -->
<TextBox