Files
annotations/Azaion.Annotator/DTO/ThumbnailDto.cs
T
2024-09-16 20:12:05 +03:00

37 lines
1000 B
C#

using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Windows.Media.Imaging;
using Azaion.Annotator.Extensions;
namespace Azaion.Annotator.DTO;
public class ThumbnailDto : INotifyPropertyChanged
{
public string ThumbnailPath { get; set; }
public string ImagePath { get; set; }
public string LabelPath { get; set; }
private BitmapImage? _image;
public BitmapImage? Image
{
get
{
if (_image == null)
Task.Run(async () => Image = await ThumbnailPath.OpenImage());
return _image;
}
set
{
_image = value;
OnPropertyChanged();
}
}
public void UpdateImage() => _image = null;
public event PropertyChangedEventHandler? PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}