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 -3
View File
@@ -35,6 +35,7 @@ public partial class DatasetExplorer
private readonly IAzaionApi _azaionApi;
private readonly IConfigUpdater _configUpdater;
private readonly IAnnotationPathResolver _pathResolver;
public bool ThumbnailLoading { get; set; }
public string CurrentFilter { get; set; } = "";
@@ -51,7 +52,8 @@ public partial class DatasetExplorer
IDbFactory dbFactory,
IMediator mediator,
IAzaionApi azaionApi,
IConfigUpdater configUpdater)
IConfigUpdater configUpdater,
IAnnotationPathResolver pathResolver)
{
InitializeComponent();
_appConfig = appConfig.Value;
@@ -61,6 +63,7 @@ public partial class DatasetExplorer
_mediator = mediator;
_azaionApi = azaionApi;
_configUpdater = configUpdater;
_pathResolver = pathResolver;
ShowWithObjectsOnlyChBox.IsChecked = _appConfig.UIConfig.ShowDatasetWithDetectionsOnly;
var photoModes = Enum.GetValues(typeof(PhotoMode)).Cast<PhotoMode>().ToList();
@@ -196,7 +199,7 @@ public partial class DatasetExplorer
ThumbnailsView.SelectedIndex = index;
var ann = CurrentAnnotation.Annotation;
var image = await ann.ImagePath.OpenImage();
var image = await _pathResolver.GetImagePath(ann).OpenImage();
ExplorerEditor.SetBackground(image);
SelectedAnnotationName.Text = ann.Name;
SwitchTab(toEditor: true);
@@ -264,7 +267,11 @@ public partial class DatasetExplorer
var annThumbnails = _annotationsDict[ExplorerEditor.CurrentAnnClass!.YoloId]
.WhereIf(withDetectionsOnly, x => x.Value.Detections.Any())
.WhereIf(!string.IsNullOrEmpty(CurrentFilter), x => x.Key.Contains(CurrentFilter, StringComparison.CurrentCultureIgnoreCase))
.Select(x => new AnnotationThumbnail(x.Value, currentUser.Role.IsValidator()))
.Select(x => new AnnotationThumbnail(
x.Value,
currentUser.Role.IsValidator(),
_pathResolver.GetImagePath(x.Value),
_pathResolver.GetThumbPath(x.Value)))
.OrderBy(x => !x.IsSeed)
.ThenByDescending(x =>x.Annotation.CreatedDate);