diff --git a/I18N Commander/UI MAUI/MauiProgram.cs b/I18N Commander/UI MAUI/MauiProgram.cs index 774472e..e68c109 100644 --- a/I18N Commander/UI MAUI/MauiProgram.cs +++ b/I18N Commander/UI MAUI/MauiProgram.cs @@ -1,4 +1,12 @@ -namespace UI_MAUI; +using Microsoft.Maui.LifecycleEvents; + +#if WINDOWS +using Microsoft.UI; +using Microsoft.UI.Windowing; +using Windows.Graphics; +#endif + +namespace UI_MAUI; public static class MauiProgram { @@ -10,6 +18,25 @@ public static class MauiProgram { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); }); + +#if WINDOWS + builder.ConfigureLifecycleEvents(events => + { + events.AddWindows(wndLifeCycleBuilder => + { + wndLifeCycleBuilder.OnWindowCreated(window => + { + var nativeWindowHandle = WinRT.Interop.WindowNative.GetWindowHandle(window); + var win32WindowsId = Win32Interop.GetWindowIdFromWindow(nativeWindowHandle); + var appWindow = AppWindow.GetFromWindowId(win32WindowsId); + + const int width = 1366; + const int height = 768; + appWindow.ResizeClient(new SizeInt32(width, height)); + }); + }); + }); +#endif builder.Services.AddMauiBlazorWebView();