From 506e9df72e6ffb8c00ba7e633741bb3b049b2460 Mon Sep 17 00:00:00 2001 From: JT Date: Thu, 25 May 2023 19:46:35 -0700 Subject: [PATCH] auto-pick the first list item if it exists --- StabilityMatrix/ViewModels/InstallerViewModel.cs | 6 ++++-- StabilityMatrix/ViewModels/LaunchViewModel.cs | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/StabilityMatrix/ViewModels/InstallerViewModel.cs b/StabilityMatrix/ViewModels/InstallerViewModel.cs index 468346be..3045998d 100644 --- a/StabilityMatrix/ViewModels/InstallerViewModel.cs +++ b/StabilityMatrix/ViewModels/InstallerViewModel.cs @@ -128,14 +128,16 @@ public class InstallerViewModel : INotifyPropertyChanged if (settingsManager.Settings.InstalledPackages.FirstOrDefault(x => x.PackageName == SelectedPackage.Name) == null) { - settingsManager.AddInstalledPackage(new InstalledPackage + var package = new InstalledPackage { Name = SelectedPackage.Name, Path = SelectedPackage.InstallLocation, Id = Guid.NewGuid(), PackageName = SelectedPackage.Name, PackageVersion = "idklol" - }); + }; + settingsManager.AddInstalledPackage(package); + settingsManager.SetActiveInstalledPackage(package); } }); diff --git a/StabilityMatrix/ViewModels/LaunchViewModel.cs b/StabilityMatrix/ViewModels/LaunchViewModel.cs index 8d7cc9b7..50a69d2b 100644 --- a/StabilityMatrix/ViewModels/LaunchViewModel.cs +++ b/StabilityMatrix/ViewModels/LaunchViewModel.cs @@ -97,6 +97,10 @@ public partial class LaunchViewModel : ObservableObject public void OnLoaded() { LoadPackages(); + if (InstalledPackages.Any()) + { + SelectedPackage = InstalledPackages[0]; + } } private void LoadPackages()