mirror of
http://git.xinwangdao.com/cnnc-embedded-parts-detect/detect.git
synced 2025-06-24 13:34:13 +08:00
83 lines
2.1 KiB
C#
83 lines
2.1 KiB
C#
using System;
|
|
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Controls.Primitives;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Markup.Xaml;
|
|
using Avalonia.Platform;
|
|
using detect.gui.Classes;
|
|
using detect.gui.VWMS;
|
|
using Splat;
|
|
using WebViewControl;
|
|
|
|
namespace detect.gui.VWS;
|
|
|
|
public partial class MainWindow : Window
|
|
{
|
|
private static MainWindow? _instance;
|
|
|
|
public static MainWindow Instance()
|
|
{
|
|
return _instance ??= new MainWindow();
|
|
}
|
|
|
|
public MainWindow()
|
|
{
|
|
InitializeComponent();
|
|
|
|
Icon = new WindowIcon(AssetLoader.Open(new Uri("avares://detect.gui/Assets/logo.ico")));
|
|
Title = "AI智能视频分析平台";
|
|
ExtendClientAreaToDecorationsHint = true;
|
|
ExtendClientAreaChromeHints = ExtendClientAreaChromeHints.NoChrome;
|
|
ExtendClientAreaTitleBarHeightHint = -1;
|
|
SystemDecorations = SystemDecorations.None;
|
|
Topmost = false;
|
|
CanResize = false;
|
|
|
|
if (Screens.Primary == null) return;
|
|
Width = Screens.Primary.Bounds.Width / Screens.Primary.Scaling;
|
|
Height = Screens.Primary.Bounds.Height / Screens.Primary.Scaling;
|
|
Position = new PixelPoint(0, 0);
|
|
|
|
DataContext = Locator.Current.GetService<MainWindowModel>();
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
AvaloniaXamlLoader.Load(this);
|
|
#if DEBUG
|
|
this.AttachDevTools();
|
|
#endif
|
|
}
|
|
|
|
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
|
|
{
|
|
base.OnApplyTemplate(e);
|
|
NotificationService.SetHostWindow(this);
|
|
}
|
|
|
|
private void MinClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
WindowState = WindowState.Minimized;
|
|
}
|
|
|
|
private void MaxClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
WindowState = WindowState.Maximized;
|
|
}
|
|
|
|
private void RestoreClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
WindowState = WindowState.Normal;
|
|
}
|
|
|
|
private void CloseClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
Close();
|
|
}
|
|
|
|
private void OnClosed(object? sender, EventArgs e)
|
|
{
|
|
this.Get<WebView>("WebView").Dispose();
|
|
}
|
|
} |