Files
annotations/Azaion.Common/DTO/AnnotationImageView.cs
T
Alex Bezdieniezhnykh 5fe46cd6f5 fix datasetexplorer view
save annotation with detections
fix sending to queue
2024-12-26 23:47:03 +02:00

43 lines
1.2 KiB
C#

using System.ComponentModel;
using System.IO;
using System.Runtime.CompilerServices;
using System.Windows.Media.Imaging;
using Azaion.Common.Extensions;
namespace Azaion.Common.DTO;
public class AnnotationImageView(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 void Delete()
{
File.Delete(Annotation.ImagePath);
File.Delete(Annotation.LabelPath);
File.Delete(Annotation.ThumbPath);
}
public event PropertyChangedEventHandler? PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}