2026-04-26 02:14:45 -05:00
|
|
|
using Avalonia.Media.Imaging;
|
|
|
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
|
|
|
|
2026-06-06 05:49:24 -05:00
|
|
|
namespace LANCommander.Launcher.ViewModels.Components;
|
2026-04-07 23:12:22 -05:00
|
|
|
|
|
|
|
|
/// <summary>Represents a single screenshot or video in the game detail media carousel.</summary>
|
2026-04-26 02:14:45 -05:00
|
|
|
public partial class GameMediaItemViewModel : ObservableObject
|
2026-04-07 23:12:22 -05:00
|
|
|
{
|
2026-04-26 02:14:45 -05:00
|
|
|
/// <summary>Local file path or remote URL for videos.</summary>
|
|
|
|
|
[ObservableProperty]
|
2026-06-15 19:31:58 -05:00
|
|
|
[NotifyPropertyChangedFor(nameof(VideoPath))]
|
2026-04-26 02:14:45 -05:00
|
|
|
private string _path = string.Empty;
|
|
|
|
|
|
|
|
|
|
[ObservableProperty]
|
2026-06-15 19:31:58 -05:00
|
|
|
[NotifyPropertyChangedFor(nameof(VideoPath))]
|
2026-04-26 02:14:45 -05:00
|
|
|
private bool _isVideo;
|
|
|
|
|
|
2026-06-15 19:31:58 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Path for the inline video player — only populated for video items. The carousel
|
|
|
|
|
/// template instantiates an InlineVideoPlayer for every item (even hidden ones for
|
|
|
|
|
/// screenshots), so binding the screenshot path here would make libvlc try to "play"
|
|
|
|
|
/// the image and leak a decoder per item. Null for screenshots keeps the player idle.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string? VideoPath => IsVideo ? Path : null;
|
|
|
|
|
|
2026-04-26 02:14:45 -05:00
|
|
|
[ObservableProperty]
|
|
|
|
|
private string _mimeType = string.Empty;
|
|
|
|
|
|
|
|
|
|
/// <summary>Pre-loaded bitmap for screenshot display (loaded from local file or remote URL).</summary>
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private Bitmap? _imageSource;
|
2026-05-10 01:44:23 -05:00
|
|
|
|
|
|
|
|
/// <summary>When true, this item is a loading placeholder that will be replaced with real content.</summary>
|
|
|
|
|
[ObservableProperty]
|
|
|
|
|
private bool _isSkeleton;
|
2026-04-07 23:12:22 -05:00
|
|
|
}
|