diff --git a/StabilityMatrix/Assets/noimage.png b/StabilityMatrix/Assets/noimage.png new file mode 100644 index 00000000..8b3cefed Binary files /dev/null and b/StabilityMatrix/Assets/noimage.png differ diff --git a/StabilityMatrix/CheckpointBrowserPage.xaml b/StabilityMatrix/CheckpointBrowserPage.xaml index 19ba9b4a..59b6af14 100644 --- a/StabilityMatrix/CheckpointBrowserPage.xaml +++ b/StabilityMatrix/CheckpointBrowserPage.xaml @@ -29,7 +29,7 @@ - + - + + + + - + PreviewMouseWheel="VirtualizingGridView_OnPreviewMouseWheel"/> { - new (null!, null!, null!) + new(null!, null!, null!) { CivitModel = new() { @@ -32,7 +34,9 @@ public class MockCheckpointBrowserViewModel : CheckpointBrowserViewModel } } } - } + }, + CardImage = new BitmapImage(new Uri( + "https://image.civitai.com/xG1nkqKTMzGDvpLrqFT7WA/1547f350-461a-4cd0-a753-0544aa81e4fc/width=450/00000-4137473915.jpeg")) } }; } diff --git a/StabilityMatrix/MainWindow.xaml b/StabilityMatrix/MainWindow.xaml index d6994b5f..d891a557 100644 --- a/StabilityMatrix/MainWindow.xaml +++ b/StabilityMatrix/MainWindow.xaml @@ -61,6 +61,7 @@ diff --git a/StabilityMatrix/StabilityMatrix.csproj b/StabilityMatrix/StabilityMatrix.csproj index 2d9c4f73..06ef862f 100644 --- a/StabilityMatrix/StabilityMatrix.csproj +++ b/StabilityMatrix/StabilityMatrix.csproj @@ -64,6 +64,10 @@ Always + + + Always + diff --git a/StabilityMatrix/ViewModels/CheckpointBrowserCardViewModel.cs b/StabilityMatrix/ViewModels/CheckpointBrowserCardViewModel.cs index 13710fd1..c167ae5c 100644 --- a/StabilityMatrix/ViewModels/CheckpointBrowserCardViewModel.cs +++ b/StabilityMatrix/ViewModels/CheckpointBrowserCardViewModel.cs @@ -1,8 +1,11 @@ using System; using System.Diagnostics; using System.IO; +using System.Linq; using System.Threading.Tasks; using System.Windows; +using System.Windows.Media.Imaging; +using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using Microsoft.Extensions.Logging; using StabilityMatrix.Extensions; @@ -18,6 +21,7 @@ public partial class CheckpointBrowserCardViewModel : ProgressViewModel private readonly IDownloadService downloadService; private readonly ISnackbarService snackbarService; public CivitModel CivitModel { get; init; } + public BitmapImage CardImage { get; init; } public override Visibility ProgressVisibility => Value > 0 ? Visibility.Visible : Visibility.Collapsed; public override Visibility TextVisibility => Value > 0 ? Visibility.Visible : Visibility.Collapsed; @@ -27,6 +31,16 @@ public partial class CheckpointBrowserCardViewModel : ProgressViewModel this.downloadService = downloadService; this.snackbarService = snackbarService; CivitModel = civitModel; + + if (civitModel.ModelVersions.Any() && civitModel.ModelVersions[0].Images.Any()) + { + CardImage = new BitmapImage(new Uri(civitModel.ModelVersions[0].Images[0].Url)); + } + else + { + CardImage = new BitmapImage( + new Uri("pack://application:,,,/StabilityMatrix;component/Assets/noimage.png")); + } } [RelayCommand] diff --git a/StabilityMatrix/ViewModels/OneClickInstallViewModel.cs b/StabilityMatrix/ViewModels/OneClickInstallViewModel.cs index d970b653..9cf694d1 100644 --- a/StabilityMatrix/ViewModels/OneClickInstallViewModel.cs +++ b/StabilityMatrix/ViewModels/OneClickInstallViewModel.cs @@ -19,6 +19,7 @@ public partial class OneClickInstallViewModel : ObservableObject private readonly IPrerequisiteHelper prerequisiteHelper; private readonly ILogger logger; private readonly IPyRunner pyRunner; + private readonly ISharedFolders sharedFolders; private const string DefaultPackageName = "stable-diffusion-webui"; [ObservableProperty] private string headerText; @@ -36,13 +37,15 @@ public partial class OneClickInstallViewModel : ObservableObject OneClickInstallProgress > 0 || IsIndeterminate ? Visibility.Visible : Visibility.Collapsed; public OneClickInstallViewModel(ISettingsManager settingsManager, IPackageFactory packageFactory, - IPrerequisiteHelper prerequisiteHelper, ILogger logger, IPyRunner pyRunner) + IPrerequisiteHelper prerequisiteHelper, ILogger logger, IPyRunner pyRunner, + ISharedFolders sharedFolders) { this.settingsManager = settingsManager; this.packageFactory = packageFactory; this.prerequisiteHelper = prerequisiteHelper; this.logger = logger; this.pyRunner = pyRunner; + this.sharedFolders = sharedFolders; HeaderText = "Welcome to Stability Matrix!"; SubHeaderText =