big refactoring. get rid of static properties and coupled architecture. prepare system for integration tests

This commit is contained in:
Oleksandr Bezdieniezhnykh
2025-11-17 13:14:05 +02:00
parent 22529c26ec
commit e7ea5a8ded
38 changed files with 808 additions and 157 deletions
+10 -4
View File
@@ -13,7 +13,9 @@ public class DatasetExplorerEventHandler(
ILogger<DatasetExplorerEventHandler> logger,
DatasetExplorer datasetExplorer,
IAnnotationService annotationService,
IAzaionApi azaionApi) :
IAzaionApi azaionApi,
IUICommandDispatcher uiDispatcher,
IAnnotationPathResolver pathResolver) :
INotificationHandler<KeyEvent>,
INotificationHandler<DatasetExplorerControlEvent>,
INotificationHandler<AnnotationCreatedEvent>,
@@ -121,7 +123,7 @@ public class DatasetExplorerEventHandler(
public async Task Handle(AnnotationCreatedEvent notification, CancellationToken token)
{
await datasetExplorer.Dispatcher.Invoke(async () =>
await uiDispatcher.ExecuteAsync(async () =>
{
var annotation = notification.Annotation;
var selectedClass = datasetExplorer.LvClasses.CurrentClassNumber;
@@ -132,7 +134,11 @@ public class DatasetExplorerEventHandler(
var index = 0;
var currentUser = await azaionApi.GetCurrentUserAsync();
var annThumb = new AnnotationThumbnail(annotation, currentUser.Role.IsValidator());
var annThumb = new AnnotationThumbnail(
annotation,
currentUser.Role.IsValidator(),
pathResolver.GetImagePath(annotation),
pathResolver.GetThumbPath(annotation));
if (datasetExplorer.SelectedAnnotationDict.ContainsKey(annThumb.Annotation.Name))
{
datasetExplorer.SelectedAnnotationDict.Remove(annThumb.Annotation.Name);
@@ -153,7 +159,7 @@ public class DatasetExplorerEventHandler(
{
try
{
datasetExplorer.Dispatcher.Invoke(() =>
uiDispatcher.Execute(() =>
{
var annThumbs = datasetExplorer.SelectedAnnotationDict
.Where(x => notification.AnnotationNames.Contains(x.Key))