mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 16:46:31 +00:00
fix ui bugs, fix RefreshThumbnails method
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Queue;
|
||||
using Azaion.Common.Events;
|
||||
@@ -103,26 +104,28 @@ public class DatasetExplorerEventHandler(
|
||||
|
||||
public async Task Handle(AnnotationCreatedEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var annotation = notification.Annotation;
|
||||
var selectedClass = datasetExplorer.LvClasses.CurrentClassNumber;
|
||||
|
||||
//TODO: For editing existing need to handle updates
|
||||
datasetExplorer.AddAnnotationToDict(annotation);
|
||||
if (annotation.Classes.Contains(selectedClass) || selectedClass == -1)
|
||||
datasetExplorer.Dispatcher.Invoke(async () =>
|
||||
{
|
||||
var annThumb = new AnnotationThumbnail(annotation);
|
||||
if (datasetExplorer.SelectedAnnotationDict.ContainsKey(annThumb.Annotation.Name))
|
||||
{
|
||||
datasetExplorer.SelectedAnnotationDict.Remove(annThumb.Annotation.Name);
|
||||
var ann = datasetExplorer.SelectedAnnotations.FirstOrDefault(x => x.Annotation.Name == annThumb.Annotation.Name);
|
||||
if (ann != null)
|
||||
datasetExplorer.SelectedAnnotations.Remove(ann);
|
||||
}
|
||||
var annotation = notification.Annotation;
|
||||
var selectedClass = datasetExplorer.LvClasses.CurrentClassNumber;
|
||||
|
||||
datasetExplorer.SelectedAnnotations.Insert(0, annThumb);
|
||||
datasetExplorer.SelectedAnnotationDict.Add(annThumb.Annotation.Name, annThumb);
|
||||
}
|
||||
await Task.CompletedTask;
|
||||
//TODO: For editing existing need to handle updates
|
||||
datasetExplorer.AddAnnotationToDict(annotation);
|
||||
if (annotation.Classes.Contains(selectedClass) || selectedClass == -1)
|
||||
{
|
||||
var annThumb = new AnnotationThumbnail(annotation);
|
||||
if (datasetExplorer.SelectedAnnotationDict.ContainsKey(annThumb.Annotation.Name))
|
||||
{
|
||||
datasetExplorer.SelectedAnnotationDict.Remove(annThumb.Annotation.Name);
|
||||
var ann = datasetExplorer.SelectedAnnotations.FirstOrDefault(x => x.Annotation.Name == annThumb.Annotation.Name);
|
||||
if (ann != null)
|
||||
datasetExplorer.SelectedAnnotations.Remove(ann);
|
||||
}
|
||||
|
||||
datasetExplorer.SelectedAnnotations.Insert(0, annThumb);
|
||||
datasetExplorer.SelectedAnnotationDict.Add(annThumb.Annotation.Name, annThumb);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public async Task Handle(AnnotationsDeletedEvent notification, CancellationToken cancellationToken)
|
||||
|
||||
Reference in New Issue
Block a user