diff --git a/StabilityMatrix/InstallerWindow.xaml b/StabilityMatrix/InstallerWindow.xaml
index d9d22672..4728f1b8 100644
--- a/StabilityMatrix/InstallerWindow.xaml
+++ b/StabilityMatrix/InstallerWindow.xaml
@@ -1,4 +1,4 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -117,19 +119,13 @@
-
-
-
-
+
+
+
+
@@ -190,20 +186,36 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Close();
}
private async void InstallPage_OnLoaded(object sender, RoutedEventArgs e)
diff --git a/StabilityMatrix/PackageManagerPage.xaml b/StabilityMatrix/PackageManagerPage.xaml
index a5e598a4..2c4461f2 100644
--- a/StabilityMatrix/PackageManagerPage.xaml
+++ b/StabilityMatrix/PackageManagerPage.xaml
@@ -15,6 +15,10 @@
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
xmlns:viewModels="clr-namespace:StabilityMatrix.ViewModels"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+
+
+
@@ -128,6 +132,13 @@
Visibility="{Binding InstallButtonVisibility, FallbackValue=Visible}"
Width="100" />
+
+
+
+
diff --git a/StabilityMatrix/ViewModels/InstallerViewModel.cs b/StabilityMatrix/ViewModels/InstallerViewModel.cs
index 748b72ab..197e515f 100644
--- a/StabilityMatrix/ViewModels/InstallerViewModel.cs
+++ b/StabilityMatrix/ViewModels/InstallerViewModel.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.ObjectModel;
using System.Diagnostics;
+using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
@@ -72,10 +73,15 @@ public partial class InstallerViewModel : ObservableObject
[ObservableProperty]
private bool isReleaseModeEnabled;
+ [ObservableProperty]
+ private bool showDuplicateWarning;
+
public Visibility ProgressBarVisibility => ProgressValue > 0 || IsIndeterminate ? Visibility.Visible : Visibility.Collapsed;
public string ReleaseLabelText => IsReleaseMode ? "Version" : "Branch";
-
+
+ internal event EventHandler? PackageInstalled;
+
public InstallerViewModel(ISettingsManager settingsManager, ILogger logger, IPyRunner pyRunner,
IPackageFactory packageFactory)
@@ -104,6 +110,7 @@ public partial class InstallerViewModel : ObservableObject
private async Task Install()
{
await ActuallyInstall();
+ OnPackageInstalled();
}
public async Task OnLoaded()
@@ -134,7 +141,7 @@ public partial class InstallerViewModel : ObservableObject
ReleaseNotes = string.Empty;
AvailableVersions?.Clear();
- // This can swallow exceptions if you don't explicity try/catch
+ // This can swallow exceptions if you don't explicitly try/catch
// Idk how to make it better tho
Task.Run(async () =>
{
@@ -182,6 +189,18 @@ public partial class InstallerViewModel : ObservableObject
OnSelectedPackageChanged(SelectedPackage);
}
+ partial void OnInstallNameChanged(string oldValue, string newValue)
+ {
+ var path = Path.GetFullPath($"{InstallPath}\\{newValue}");
+ ShowDuplicateWarning = settingsManager.Settings.InstalledPackages.Any(p => p.Path.Equals(path));
+ }
+
+ partial void OnInstallPathChanged(string oldValue, string newValue)
+ {
+ var path = Path.GetFullPath($"{newValue}\\{InstallName}");
+ ShowDuplicateWarning = settingsManager.Settings.InstalledPackages.Any(p => p.Path.Equals(path));
+ }
+
partial void OnSelectedVersionChanged(PackageVersion? value)
{
ReleaseNotes = value?.ReleaseNotesMarkdown ?? string.Empty;
@@ -255,6 +274,8 @@ public partial class InstallerViewModel : ObservableObject
};
settingsManager.AddInstalledPackage(package);
settingsManager.SetActiveInstalledPackage(package);
+
+ ProgressValue = 0;
}
private Task DownloadPackage(string version)
@@ -313,5 +334,7 @@ public partial class InstallerViewModel : ObservableObject
EventManager.Instance.OnGlobalProgressChanged(progress);
}
-
+
+ private void OnPackageInstalled() => PackageInstalled?.Invoke(this, EventArgs.Empty);
+
}
diff --git a/StabilityMatrix/ViewModels/OneClickInstallViewModel.cs b/StabilityMatrix/ViewModels/OneClickInstallViewModel.cs
index b0a029cf..9d5bfb78 100644
--- a/StabilityMatrix/ViewModels/OneClickInstallViewModel.cs
+++ b/StabilityMatrix/ViewModels/OneClickInstallViewModel.cs
@@ -41,9 +41,11 @@ public partial class OneClickInstallViewModel : ObservableObject
this.logger = logger;
this.pyRunner = pyRunner;
- HeaderText = "Click the Install button below to get started!";
+ HeaderText = "Welcome to Stability Matrix!";
SubHeaderText =
- "This will install the latest version of Stable Diffusion WebUI by Automatic1111.\nIf you don't know what this means, don't worry, you'll be generating images soon!";
+ "Click the Install button below to get started!\n" +
+ "This will install the latest version of Stable Diffusion WebUI by Automatic1111.\n" +
+ "If you don't know what this means, don't worry, you'll be generating images soon!";
ShowInstallButton = true;
}
diff --git a/StabilityMatrix/ViewModels/PackageManagerViewModel.cs b/StabilityMatrix/ViewModels/PackageManagerViewModel.cs
index 88f28d39..696fbeeb 100644
--- a/StabilityMatrix/ViewModels/PackageManagerViewModel.cs
+++ b/StabilityMatrix/ViewModels/PackageManagerViewModel.cs
@@ -50,6 +50,9 @@ public partial class PackageManagerViewModel : ObservableObject
[ObservableProperty]
private Visibility installButtonVisibility;
+ [ObservableProperty]
+ private bool isUninstalling;
+
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(SelectedPackage))]
private bool updateAvailable;
@@ -170,6 +173,7 @@ public partial class PackageManagerViewModel : ObservableObject
if (result == ContentDialogResult.Primary)
{
+ IsUninstalling = true;
var deleteTask = DeleteDirectoryAsync(SelectedPackage.Path);
var taskResult = await dialogErrorHandler.TryAsync(deleteTask,
"Some files could not be deleted. Please close any open files in the package directory and try again.");
@@ -178,6 +182,7 @@ public partial class PackageManagerViewModel : ObservableObject
settingsManager.RemoveInstalledPackage(SelectedPackage);
}
await OnLoaded();
+ IsUninstalling = false;
}
}