using Microsoft.UI.Windowing; using Microsoft.UI.Xaml; using Windows.Graphics; namespace LumaTunnel.Client; public sealed partial class MainWindow : Window { public MainWindow() { InitializeComponent(); ExtendsContentIntoTitleBar = true; AppWindow.SetIcon(Path.Combine(AppContext.BaseDirectory, "Assets", "LumaTunnel.ico")); AppWindow.Resize(new SizeInt32(1120, 760)); AppWindow.Closing += OnClosing; AppServices.RootNavigation.Initialize(RootFrame); } public void ShowFromTray() { AppWindow.Show(); Activate(); } private void OnClosing(AppWindow sender, AppWindowClosingEventArgs args) { if (!App.CurrentApp.IsExiting && AppServices.Profile.CloseToTray) { args.Cancel = true; sender.Hide(); return; } if (!App.CurrentApp.IsExiting) { args.Cancel = true; _ = App.CurrentApp.RequestExitAsync(); } } }