mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 08:06:31 +00:00
add left menu with icons
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using System.Windows;
|
||||
using Azaion.Common.DTO;
|
||||
|
||||
namespace Azaion.Annotator;
|
||||
|
||||
public class AnnotatorModule : IAzaionModule
|
||||
{
|
||||
public string Name => "Анотатор";
|
||||
|
||||
public string SvgIcon =>
|
||||
@"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||
<!-- Generator: Adobe Illustrator 28.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version=""1.1"" id=""Layer_1"" xmlns=""http://www.w3.org/2000/svg"" xmlns:xlink=""http://www.w3.org/1999/xlink"" x=""0px"" y=""0px""
|
||||
viewBox=""0 0 800 800"" style=""enable-background:new 0 0 800 800;"" xml:space=""preserve"">
|
||||
<style type=""text/css"">
|
||||
.st0{fill:#FFFFFF;}
|
||||
.st1{opacity:0.75;fill:#006932;stroke:#000000;stroke-width:20;stroke-miterlimit:10;}
|
||||
.st2{opacity:0.75;fill:#6C0A0B;stroke:#000000;stroke-width:20;stroke-miterlimit:10;}
|
||||
.st3{fill:#FFFFFF;stroke:#434444;stroke-width:8;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id=""SVGRepo_bgCarrier"">
|
||||
</g>
|
||||
<g id=""SVGRepo_tracerCarrier"">
|
||||
</g>
|
||||
<g id=""SVGRepo_iconCarrier"">
|
||||
<g transform=""translate(1)"">
|
||||
<g>
|
||||
<polygon class=""st0"" points=""465.7,93.3 545.7,93.3 545.7,13.3 465.7,13.3""/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<rect x=""43.3"" y=""53.3"" class=""st1"" width=""609.7"" height=""301""/>
|
||||
<rect x=""443.2"" y=""400"" class=""st2"" width=""285.8"" height=""363""/>
|
||||
<g>
|
||||
<rect x=""19"" y=""325"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""17.5"" y=""166"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""17.5"" y=""27"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""325.5"" y=""329"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""624.5"" y=""325"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""626.5"" y=""168"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""626.5"" y=""27"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""323.5"" y=""27"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""419.8"" y=""377.3"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""698.7"" y=""378.3"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""418.5"" y=""733.2"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""698.7"" y=""736.5"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""415.8"" y=""555.7"" class=""st3"" width=""53"" height=""53""/>
|
||||
<rect x=""701.2"" y=""551.7"" class=""st3"" width=""53"" height=""53""/>
|
||||
</g>
|
||||
</svg>";
|
||||
|
||||
public Type MainWindowType => typeof(Annotator);
|
||||
}
|
||||
@@ -42,4 +42,11 @@
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="annotator-logo.svg" />
|
||||
<Resource Include="annotator-logo.svg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 28.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 800 800" style="enable-background:new 0 0 800 800;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill:#FFFFFF;}
|
||||
.st1{opacity:0.75;fill:#006932;stroke:#000000;stroke-width:20;stroke-miterlimit:10;}
|
||||
.st2{opacity:0.75;fill:#6C0A0B;stroke:#000000;stroke-width:20;stroke-miterlimit:10;}
|
||||
.st3{opacity:0.85;fill:#FFFFFF;stroke:#000000;stroke-width:20;stroke-miterlimit:10;}
|
||||
</style>
|
||||
<g id="SVGRepo_bgCarrier">
|
||||
</g>
|
||||
<g id="SVGRepo_tracerCarrier">
|
||||
</g>
|
||||
<g id="SVGRepo_iconCarrier">
|
||||
<g transform="translate(1)">
|
||||
<g>
|
||||
<polygon class="st0" points="465.7,93.3 545.7,93.3 545.7,13.3 465.7,13.3 "/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
<rect x="43.3" y="53.3" class="st1" width="609.7" height="301"/>
|
||||
<rect x="443.2" y="400" class="st2" width="285.8" height="363"/>
|
||||
<rect x="19" y="325" class="st3" width="53" height="53"/>
|
||||
<rect x="17.5" y="166" class="st3" width="53" height="53"/>
|
||||
<rect x="17.5" y="27" class="st3" width="53" height="53"/>
|
||||
<rect x="325.5" y="329" class="st3" width="53" height="53"/>
|
||||
<rect x="624.5" y="325" class="st3" width="53" height="53"/>
|
||||
<rect x="626.5" y="168" class="st3" width="53" height="53"/>
|
||||
<rect x="626.5" y="27" class="st3" width="53" height="53"/>
|
||||
<rect x="323.5" y="27" class="st3" width="53" height="53"/>
|
||||
<rect x="419.8" y="377.3" class="st3" width="53" height="53"/>
|
||||
<rect x="698.7" y="378.3" class="st3" width="53" height="53"/>
|
||||
<rect x="418.5" y="733.2" class="st3" width="53" height="53"/>
|
||||
<rect x="698.7" y="736.5" class="st3" width="53" height="53"/>
|
||||
<rect x="415.8" y="555.7" class="st3" width="53" height="53"/>
|
||||
<rect x="701.2" y="551.7" class="st3" width="53" height="53"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.8 KiB |
@@ -0,0 +1,8 @@
|
||||
namespace Azaion.Common.DTO;
|
||||
|
||||
public interface IAzaionModule
|
||||
{
|
||||
string Name { get; }
|
||||
string SvgIcon { get; }
|
||||
Type MainWindowType { get; }
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using Azaion.Common.DTO;
|
||||
|
||||
namespace Azaion.Dataset;
|
||||
|
||||
public class DatasetExplorerModule : IAzaionModule
|
||||
{
|
||||
public string Name => "Переглядач Анотацій";
|
||||
|
||||
public string SvgIcon =>
|
||||
@"<?xml version=""1.0"" encoding=""utf-8""?>
|
||||
<svg width=""800px"" height=""800px"" viewBox=""0 0 24 24"" xmlns=""http://www.w3.org/2000/svg"" fill=""none"" stroke=""#000000"" stroke-width=""1"" stroke-linecap=""round"" stroke-linejoin=""miter"">
|
||||
<rect x=""2"" y=""2"" width=""8"" height=""8"" rx=""0"" fill=""#059cf7"" opacity=""0.8""></rect>
|
||||
<rect x=""2"" y=""14"" width=""8"" height=""8"" rx=""0"" fill=""#059cf7"" opacity=""0.8""></rect>
|
||||
<rect x=""14"" y=""2"" width=""8"" height=""8"" rx=""0"" fill=""#059cf7"" opacity=""0.8""></rect>
|
||||
<rect x=""14"" y=""14"" width=""8"" height=""8"" rx=""0"" fill=""#059cf7"" opacity=""0.8""></rect>
|
||||
<rect x=""2"" y=""2"" width=""8"" height=""8"" rx=""0""></rect>
|
||||
<rect x=""2"" y=""14"" width=""8"" height=""8"" rx=""0""></rect>
|
||||
<rect x=""14"" y=""2"" width=""8"" height=""8"" rx=""0""></rect>
|
||||
<rect x=""14"" y=""14"" width=""8"" height=""8"" rx=""0""></rect>
|
||||
</svg>";
|
||||
|
||||
public Type MainWindowType => typeof(DatasetExplorer);
|
||||
}
|
||||
@@ -142,6 +142,9 @@ public partial class App
|
||||
|
||||
services.AddSingleton<DatasetExplorer>();
|
||||
services.AddSingleton<IGalleryManager, GalleryManager>();
|
||||
|
||||
services.AddSingleton<IAzaionModule, AnnotatorModule>();
|
||||
services.AddSingleton<IAzaionModule, DatasetExplorerModule>();
|
||||
})
|
||||
.Build();
|
||||
_mediator = _host.Services.GetRequiredService<IMediator>();
|
||||
@@ -176,6 +179,6 @@ public partial class App
|
||||
base.OnExit(e);
|
||||
|
||||
await _host.StopAsync();
|
||||
_host.Dispose();
|
||||
//_host.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,8 @@
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="SharpVectors" Version="1.8.4.2" />
|
||||
<PackageReference Include="SharpVectors.Wpf" Version="1.8.4.2" />
|
||||
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.21" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
Title="MainSuite" Height="450" Width="800">
|
||||
<Grid>
|
||||
<Grid Background="Black">
|
||||
<TabControl Name="MainTabControl"
|
||||
TabStripPlacement="Left"
|
||||
Margin="0, 0, 0, 10"
|
||||
|
||||
@@ -1,10 +1,15 @@
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using Azaion.Annotator.Extensions;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Config;
|
||||
using Azaion.Dataset;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using SharpVectors.Converters;
|
||||
|
||||
namespace Azaion.Suite;
|
||||
|
||||
@@ -12,14 +17,15 @@ public partial class MainSuite
|
||||
{
|
||||
private readonly AppConfig _appConfig;
|
||||
private readonly IConfigUpdater _configUpdater;
|
||||
private readonly Annotator.Annotator _annotator;
|
||||
private readonly DatasetExplorer _datasetExplorer;
|
||||
private readonly IEnumerable<IAzaionModule> _modules;
|
||||
private readonly IServiceProvider _sp;
|
||||
private readonly List<Window> _openedWindows = new();
|
||||
|
||||
public MainSuite(IOptions<AppConfig> appConfig, IConfigUpdater configUpdater, Annotator.Annotator annotator, DatasetExplorer datasetExplorer)
|
||||
public MainSuite(IOptions<AppConfig> appConfig, IConfigUpdater configUpdater, IEnumerable<IAzaionModule> 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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user