rework to floating window on the top

TODO: keys
This commit is contained in:
Alex Bezdieniezhnykh
2024-11-25 17:53:15 +02:00
parent 9e0bb1e82e
commit 7430b33b8e
2 changed files with 42 additions and 42 deletions
+28 -35
View File
@@ -6,7 +6,6 @@ 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;
@@ -34,6 +33,7 @@ public partial class MainSuite
SizeChanged += async (_, _) => await SaveUserSettings();
LocationChanged += async (_, _) => await SaveUserSettings();
StateChanged += async (_, _) => await SaveUserSettings();
Left = SystemParameters.WorkArea.Width - Width - 150;
}
private void OnLoaded(object sender, RoutedEventArgs e)
@@ -45,47 +45,40 @@ public partial class MainSuite
if (!Directory.Exists(_appConfig.DirectoriesConfig.ResultsDirectory))
Directory.CreateDirectory(_appConfig.DirectoriesConfig.ResultsDirectory);
Left = _appConfig.WindowConfig.WindowLocation.X;
Top = _appConfig.WindowConfig.WindowLocation.Y;
Width = _appConfig.WindowConfig.WindowSize.Width;
Height = _appConfig.WindowConfig.WindowSize.Height;
if (_appConfig.WindowConfig.FullScreen)
WindowState = WindowState.Maximized;
foreach (var azaionModule in _modules)
{
var window = (_sp.GetRequiredService(azaionModule.MainWindowType) as Window)!;
window.Height = 0;
window.Width = 0;
window.Show();
window.Hide();
_openedWindows.Add(window);
var icon = new SvgViewbox
var lvItem = new ListViewItem
{
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,
Content = new StackPanel { Children =
{
new SvgViewbox
{
SvgSource = azaionModule.SvgIcon,
Width = 32,
Height = 32,
Margin = new Thickness(0, 0, 10, 0)
},
new TextBlock
{
Text = azaionModule.Name,
Foreground = Brushes.White,
HorizontalAlignment = HorizontalAlignment.Center,
Background = Brushes.Black
}
} },
Background = Brushes.Black,
Foreground = Brushes.White,
Cursor = Cursors.Hand,
Tag = azaionModule.WindowEnum
Tag = azaionModule
};
MainTabControl.Items.Add(tabItem);
lvItem.MouseUp += (sender, _) =>
{
var module = ((sender as ListViewItem)!.Tag as IAzaionModule)!;
var window = (_sp.GetRequiredService(module.MainWindowType) as Window)!;
_openedWindows.Add(window);
window.Show();
};
ListView.Items.Add(lvItem);
}
}