From 8e644e4c1bc610452092deacded2846329df9622 Mon Sep 17 00:00:00 2001 From: JT Date: Sat, 22 Jul 2023 00:42:15 -0700 Subject: [PATCH] keepFolderLinksOnShutdown -> RemoveFolderLinksOnShutdown & also fix app version --- StabilityMatrix.Avalonia/App.axaml.cs | 4 ++-- .../ViewModels/SettingsViewModel.cs | 22 +++++++++++++++---- .../Views/SettingsPage.axaml | 8 +++---- .../Models/Settings/Settings.cs | 2 +- StabilityMatrix/App.xaml.cs | 4 ++-- .../ViewModels/SettingsViewModel.cs | 6 ++--- 6 files changed, 30 insertions(+), 16 deletions(-) diff --git a/StabilityMatrix.Avalonia/App.axaml.cs b/StabilityMatrix.Avalonia/App.axaml.cs index b9dc0b20..9bb76323 100644 --- a/StabilityMatrix.Avalonia/App.axaml.cs +++ b/StabilityMatrix.Avalonia/App.axaml.cs @@ -358,11 +358,11 @@ public sealed class App : Application // Services.GetRequiredService().OnShutdown(); var settingsManager = Services.GetRequiredService(); - // Unless KeepFolderLinksOnShutdown is set, delete all package junctions + // If RemoveFolderLinksOnShutdown is set, delete all package junctions if (settingsManager is { IsLibraryDirSet: true, - Settings.KeepFolderLinksOnShutdown: false + Settings.RemoveFolderLinksOnShutdown: true }) { var sharedFolders = Services.GetRequiredService(); diff --git a/StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs index f48f79ba..2ce4573c 100644 --- a/StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs @@ -34,10 +34,18 @@ public partial class SettingsViewModel : PageViewModelBase public override string Title => "Settings"; public override IconSource IconSource => new SymbolIconSource {Symbol = Symbol.Settings, IsFilled = true}; + public string AppVersion => GetAppVersion(); // Theme panel [ObservableProperty] private string? selectedTheme; + // Debug info + [ObservableProperty] private string? debugPaths; + [ObservableProperty] private string? debugCompatInfo; + [ObservableProperty] private string? debugGpuInfo; + + [ObservableProperty] private bool removeSymlinksOnShutdown; + public ObservableCollection AvailableThemes { get; } = new() { "Light", @@ -57,6 +65,7 @@ public partial class SettingsViewModel : PageViewModelBase this.pyRunner = pyRunner; SelectedTheme = AvailableThemes[1]; + RemoveSymlinksOnShutdown = settingsManager.Settings.RemoveFolderLinksOnShutdown; } partial void OnSelectedThemeChanged(string? value) @@ -72,10 +81,6 @@ public partial class SettingsViewModel : PageViewModelBase }; } - // Debug info - [ObservableProperty] private string? debugPaths; - [ObservableProperty] private string? debugCompatInfo; - [ObservableProperty] private string? debugGpuInfo; public void LoadDebugInfo() { @@ -183,4 +188,13 @@ public partial class SettingsViewModel : PageViewModelBase dialog.PrimaryButtonText = "Ok"; await dialog.ShowAsync(); } + + private static string GetAppVersion() + { + var assembly = Assembly.GetExecutingAssembly(); + var version = assembly.GetName().Version; + return version == null + ? "(Unknown)" + : $"Version {version.Major}.{version.Minor}.{version.Build}"; + } } diff --git a/StabilityMatrix.Avalonia/Views/SettingsPage.axaml b/StabilityMatrix.Avalonia/Views/SettingsPage.axaml index 7294842e..92ee9df0 100644 --- a/StabilityMatrix.Avalonia/Views/SettingsPage.axaml +++ b/StabilityMatrix.Avalonia/Views/SettingsPage.axaml @@ -39,8 +39,8 @@ @@ -165,9 +165,9 @@