Files
annotations/Azaion.Dataset/ThumbnailDto.cs
T
Alex Bezdieniezhnykh 5a592e9dbf rework to Azaion.Suite
2024-11-21 13:41:32 +02:00

39 lines
1.1 KiB
C#

using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;
using System.Windows.Media.Imaging;
namespace Azaion.Dataset;
public class ThumbnailDto : INotifyPropertyChanged
{
public string ThumbnailPath { get; set; } = null!;
public string ImagePath { get; set; } = null!;
public string LabelPath { get; set; } = null!;
public DateTime ImageDate { 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 string ImageName => Path.GetFileName(ImagePath);
public void UpdateImage() => _image = null;
public event PropertyChangedEventHandler? PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}