mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 22:16:30 +00:00
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using System.ComponentModel;
|
|
using System.IO;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Windows.Media.Imaging;
|
|
using Azaion.Common.Database;
|
|
using Azaion.Common.Extensions;
|
|
|
|
namespace Azaion.Common.DTO;
|
|
|
|
public class AnnotationThumbnail(Annotation annotation) : INotifyPropertyChanged
|
|
{
|
|
public Annotation Annotation { get; set; } = annotation;
|
|
|
|
private BitmapImage? _thumbnail;
|
|
public BitmapImage? Thumbnail
|
|
{
|
|
get
|
|
{
|
|
if (_thumbnail == null)
|
|
Task.Run(async () => Thumbnail = await Annotation.ThumbPath.OpenImage());
|
|
return _thumbnail;
|
|
}
|
|
private set
|
|
{
|
|
_thumbnail = value;
|
|
OnPropertyChanged();
|
|
}
|
|
}
|
|
|
|
public string ImageName => Path.GetFileName(Annotation.ImagePath);
|
|
public bool IsSeed => Annotation.AnnotationStatus == AnnotationStatus.Created;
|
|
|
|
public event PropertyChangedEventHandler? PropertyChanged;
|
|
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
|
|
{
|
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
|
}
|
|
} |