Errors sending to UI

notifying client of AI model conversion
This commit is contained in:
dzaitsev
2025-05-07 17:32:29 +03:00
committed by Alex Bezdieniezhnykh
42 changed files with 630 additions and 363 deletions
@@ -13,7 +13,7 @@ namespace Azaion.Dataset;
public class DatasetExplorerEventHandler(
DatasetExplorer datasetExplorer,
AnnotationService annotationService) :
IAnnotationService annotationService) :
INotificationHandler<KeyEvent>,
INotificationHandler<DatasetExplorerControlEvent>,
INotificationHandler<AnnotationCreatedEvent>,
@@ -26,7 +26,9 @@ public class DatasetExplorerEventHandler(
{ Key.X, PlaybackControlEnum.RemoveAllAnns },
{ Key.Escape, PlaybackControlEnum.Close },
{ Key.Down, PlaybackControlEnum.Next },
{ Key.PageDown, PlaybackControlEnum.Next },
{ Key.Up, PlaybackControlEnum.Previous },
{ Key.PageUp, PlaybackControlEnum.Previous },
{ Key.V, PlaybackControlEnum.ValidateAnnotations},
};
@@ -116,20 +118,23 @@ public class DatasetExplorerEventHandler(
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)
{
var index = 0;
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)
{
index = datasetExplorer.SelectedAnnotations.IndexOf(ann);
datasetExplorer.SelectedAnnotations.Remove(ann);
}
}
datasetExplorer.SelectedAnnotations.Insert(0, annThumb);
datasetExplorer.SelectedAnnotations.Insert(index, annThumb);
datasetExplorer.SelectedAnnotationDict.Add(annThumb.Annotation.Name, annThumb);
}
});