mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 11:06:30 +00:00
small fixes, renames
This commit is contained in:
@@ -28,7 +28,8 @@ public class AnnotatorEventHandler(
|
||||
INotificationHandler<KeyEvent>,
|
||||
INotificationHandler<AnnClassSelectedEvent>,
|
||||
INotificationHandler<AnnotatorControlEvent>,
|
||||
INotificationHandler<VolumeChangedEvent>
|
||||
INotificationHandler<VolumeChangedEvent>,
|
||||
INotificationHandler<AnnotationsDeletedEvent>
|
||||
{
|
||||
private const int STEP = 20;
|
||||
private const int LARGE_STEP = 5000;
|
||||
@@ -269,4 +270,28 @@ public class AnnotatorEventHandler(
|
||||
var annotation = await annotationService.SaveAnnotation(fName, imageExtension, currentDetections, SourceEnum.Manual, token: cancellationToken);
|
||||
mainWindow.AddAnnotation(annotation);
|
||||
}
|
||||
|
||||
public async Task Handle(AnnotationsDeletedEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var annResDict = formState.AnnotationResults.ToDictionary(x => x.Annotation.Name, x => x);
|
||||
foreach (var ann in notification.Annotations)
|
||||
{
|
||||
if (!annResDict.TryGetValue(ann.Name, out var value))
|
||||
continue;
|
||||
|
||||
formState.AnnotationResults.Remove(value);
|
||||
mainWindow.TimedAnnotations.Remove(ann);
|
||||
}
|
||||
|
||||
if (formState.AnnotationResults.Count == 0)
|
||||
{
|
||||
var media = mainWindow.AllMediaFiles.FirstOrDefault(x => x.Name == formState.CurrentMedia?.Name);
|
||||
if (media != null)
|
||||
{
|
||||
media.HasAnnotations = false;
|
||||
mainWindow.LvFiles.Items.Refresh();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user