mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:36:31 +00:00
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using System.ComponentModel;
|
|
using System.IO;
|
|
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; }
|
|
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));
|
|
}
|
|
} |