You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
871 B
31 lines
871 B
using System; |
|
using System.Linq; |
|
using CommunityToolkit.Mvvm.ComponentModel; |
|
using CommunityToolkit.Mvvm.Input; |
|
using StabilityMatrix.Avalonia.ViewModels.Base; |
|
using StabilityMatrix.Core.Models.Api; |
|
|
|
namespace StabilityMatrix.Avalonia.ViewModels.Dialogs; |
|
|
|
public partial class RecommendedModelItemViewModel : ViewModelBase |
|
{ |
|
[ObservableProperty] |
|
private bool isSelected; |
|
|
|
[ObservableProperty] |
|
private string author; |
|
|
|
[ObservableProperty] |
|
private CivitModelVersion modelVersion; |
|
|
|
[ObservableProperty] |
|
private CivitModel civitModel; |
|
|
|
public Uri ThumbnailUrl => |
|
ModelVersion.Images?.FirstOrDefault(x => x.Type == "image")?.Url == null |
|
? Assets.NoImage |
|
: new Uri(ModelVersion.Images.First(x => x.Type == "image").Url); |
|
|
|
[RelayCommand] |
|
public void ToggleSelection() => IsSelected = !IsSelected; |
|
}
|
|
|