diff --git a/StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs index ebf9373f..34a0f196 100644 --- a/StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/MainWindowViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using AsyncAwaitBestPractices; using Avalonia.Controls.Primitives; using CommunityToolkit.Mvvm.ComponentModel; using FluentAvalonia.UI.Controls; @@ -62,7 +63,7 @@ public partial class MainWindowViewModel : ViewModelBase } // Index checkpoints if we dont have - settingsManager.IndexCheckpoints(); + Task.Run(() => settingsManager.IndexCheckpoints()).SafeFireAndForget(); if (!settingsManager.Settings.InstalledPackages.Any()) { diff --git a/StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs b/StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs index 65148d8e..378bbcdc 100644 --- a/StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs +++ b/StabilityMatrix.Avalonia/ViewModels/SettingsViewModel.cs @@ -118,6 +118,14 @@ public partial class SettingsViewModel : PageViewModelBase settingsManager.Transaction(s => s.RemoveFolderLinksOnShutdown = value); } + public async Task ResetCheckpointCache() + { + settingsManager.Transaction(s => s.InstalledModelHashes = new HashSet()); + await Task.Run(() => settingsManager.IndexCheckpoints()); + notificationService.Show("Checkpoint cache reset", "The checkpoint cache has been reset.", + NotificationType.Success); + } + #region Package Environment [RelayCommand] @@ -186,8 +194,6 @@ public partial class SettingsViewModel : PageViewModelBase } #endregion - - #region System diff --git a/StabilityMatrix.Avalonia/Views/SettingsPage.axaml b/StabilityMatrix.Avalonia/Views/SettingsPage.axaml index 0e58ca5b..114d64f6 100644 --- a/StabilityMatrix.Avalonia/Views/SettingsPage.axaml +++ b/StabilityMatrix.Avalonia/Views/SettingsPage.axaml @@ -41,7 +41,7 @@ - + + Margin="8,8"> + + +