diff --git a/Azaion.Annotator/AnnotatorModule.cs b/Azaion.Annotator/AnnotatorModule.cs
new file mode 100644
index 0000000..58a84d5
--- /dev/null
+++ b/Azaion.Annotator/AnnotatorModule.cs
@@ -0,0 +1,53 @@
+using System.Windows;
+using Azaion.Common.DTO;
+
+namespace Azaion.Annotator;
+
+public class AnnotatorModule : IAzaionModule
+{
+ public string Name => "Анотатор";
+
+ public string SvgIcon =>
+@"
+
+";
+
+ public Type MainWindowType => typeof(Annotator);
+}
\ No newline at end of file
diff --git a/Azaion.Annotator/Azaion.Annotator.csproj b/Azaion.Annotator/Azaion.Annotator.csproj
index bf6bf30..16b70fe 100644
--- a/Azaion.Annotator/Azaion.Annotator.csproj
+++ b/Azaion.Annotator/Azaion.Annotator.csproj
@@ -42,4 +42,11 @@
+
+
+
+ PreserveNewest
+
+
+
diff --git a/Azaion.Annotator/annotator-logo.svg b/Azaion.Annotator/annotator-logo.svg
new file mode 100644
index 0000000..1321274
--- /dev/null
+++ b/Azaion.Annotator/annotator-logo.svg
@@ -0,0 +1,38 @@
+
+
+
diff --git a/Azaion.Common/DTO/IAzaionModule.cs b/Azaion.Common/DTO/IAzaionModule.cs
new file mode 100644
index 0000000..3ae48cb
--- /dev/null
+++ b/Azaion.Common/DTO/IAzaionModule.cs
@@ -0,0 +1,8 @@
+namespace Azaion.Common.DTO;
+
+public interface IAzaionModule
+{
+ string Name { get; }
+ string SvgIcon { get; }
+ Type MainWindowType { get; }
+}
\ No newline at end of file
diff --git a/Azaion.Dataset/DatasetExplorerModule.cs b/Azaion.Dataset/DatasetExplorerModule.cs
new file mode 100644
index 0000000..ee2fb91
--- /dev/null
+++ b/Azaion.Dataset/DatasetExplorerModule.cs
@@ -0,0 +1,23 @@
+using Azaion.Common.DTO;
+
+namespace Azaion.Dataset;
+
+public class DatasetExplorerModule : IAzaionModule
+{
+ public string Name => "Переглядач Анотацій";
+
+ public string SvgIcon =>
+ @"
+";
+
+ public Type MainWindowType => typeof(DatasetExplorer);
+}
\ No newline at end of file
diff --git a/Azaion.Suite/App.xaml.cs b/Azaion.Suite/App.xaml.cs
index bd9654b..4e3f900 100644
--- a/Azaion.Suite/App.xaml.cs
+++ b/Azaion.Suite/App.xaml.cs
@@ -142,6 +142,9 @@ public partial class App
services.AddSingleton();
services.AddSingleton();
+
+ services.AddSingleton();
+ services.AddSingleton();
})
.Build();
_mediator = _host.Services.GetRequiredService();
@@ -176,6 +179,6 @@ public partial class App
base.OnExit(e);
await _host.StopAsync();
- _host.Dispose();
+ //_host.Dispose();
}
}
\ No newline at end of file
diff --git a/Azaion.Suite/Azaion.Suite.csproj b/Azaion.Suite/Azaion.Suite.csproj
index da1416d..cfc5ef2 100644
--- a/Azaion.Suite/Azaion.Suite.csproj
+++ b/Azaion.Suite/Azaion.Suite.csproj
@@ -22,6 +22,8 @@
+
+
diff --git a/Azaion.Suite/MainSuite.xaml b/Azaion.Suite/MainSuite.xaml
index 4479a5f..23d642f 100644
--- a/Azaion.Suite/MainSuite.xaml
+++ b/Azaion.Suite/MainSuite.xaml
@@ -5,7 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
Title="MainSuite" Height="450" Width="800">
-
+
_modules;
+ private readonly IServiceProvider _sp;
+ private readonly List _openedWindows = new();
- public MainSuite(IOptions appConfig, IConfigUpdater configUpdater, Annotator.Annotator annotator, DatasetExplorer datasetExplorer)
+ public MainSuite(IOptions appConfig, IConfigUpdater configUpdater, IEnumerable modules, IServiceProvider sp )
{
_configUpdater = configUpdater;
- _annotator = annotator;
- _datasetExplorer = datasetExplorer;
+ _modules = modules;
+ _sp = sp;
_appConfig = appConfig.Value;
InitializeComponent();
Loaded += OnLoaded;
@@ -48,16 +54,34 @@ public partial class MainSuite
if (_appConfig.WindowConfig.FullScreen)
WindowState = WindowState.Maximized;
- MainTabControl.Items.Add(new TabItem
+ foreach (var azaionModule in _modules)
{
- Header = "Annotator",
- Content = _annotator.Content
- });
- MainTabControl.Items.Add(new TabItem
- {
- Header = "Dataset Explorer",
- Content = _datasetExplorer.Content
- });
+ var window = (_sp.GetRequiredService(azaionModule.MainWindowType) as Window)!;
+ _openedWindows.Add(window);
+ var icon = new SvgViewbox
+ {
+ SvgSource = azaionModule.SvgIcon,
+ Width = 32,
+ Height = 32,
+ Margin = new Thickness(0, 0, 10, 0)
+ };
+ var text = new TextBlock
+ {
+ Text = azaionModule.Name,
+ Foreground = Brushes.White,
+ HorizontalAlignment = HorizontalAlignment.Center,
+ Background = Brushes.Black
+ };
+ var tabItem = new TabItem
+ {
+ Header = new StackPanel { Children = { icon, text } },
+ Content = window.Content,
+ Background = Brushes.Black,
+ Foreground = Brushes.White,
+ Cursor = Cursors.Hand
+ };
+ MainTabControl.Items.Add(tabItem);
+ }
}
private async Task SaveUserSettings()
@@ -72,5 +96,8 @@ public partial class MainSuite
private void OnFormClosed(object? sender, EventArgs e)
{
_configUpdater.Save(_appConfig);
+ foreach (var window in _openedWindows)
+ window.Close();
+ Application.Current.Shutdown();
}
}
\ No newline at end of file