Last active
August 30, 2022 05:40
-
-
Save LanceMcCarthy/c8d23f5ba6157d5d53bee3b1a741f8b5 to your computer and use it in GitHub Desktop.
Revisions
-
LanceMcCarthy revised this gist
Jun 9, 2022 . 1 changed file with 1 addition and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,17 +29,13 @@ public static MauiApp CreateMauiApp() { wndLifeCycleBuilder.OnWindowCreated(window => { // Hard coded logic to center window on a 1920x1080 display, adjust as needed const int width = 1200; const int height = 800; const int x = 1920 / 2 - width / 2; const int y = 1080 / 2 - height / 2; window.MoveAndResize(new RectInt32(x, y, width, height)); }); }); }); -
LanceMcCarthy revised this gist
May 6, 2022 . 2 changed files with 0 additions and 1 deletion.There are no files selected for viewing
File renamed without changes.This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,6 @@ public static MauiApp CreateMauiApp() var builder = MauiApp.CreateBuilder(); builder .UseMauiApp<App>() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); -
LanceMcCarthy revised this gist
May 6, 2022 . No changes.There are no files selected for viewing
-
LanceMcCarthy revised this gist
May 6, 2022 . 2 changed files with 55 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ // ******** MacCatalyst Window management ******** // using Microsoft.Maui.LifecycleEvents; #elif MACCATALYST using AppKit; using CoreGraphics; using Foundation; using UIKit; #endif namespace Hacked.Maui { public static class MauiProgram { public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .UseMauiApp<App>() .UseTelerik() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); }); builder.ConfigureLifecycleEvents(events => { #elif MACCATALYST events.AddiOS(wndLifeCycleBuilder => { wndLifeCycleBuilder.SceneWillConnect((scene, session, options) => { if (scene is UIWindowScene { SizeRestrictions: { } } windowScene) { windowScene.SizeRestrictions.MaximumSize = new CGSize(1200, 900); windowScene.SizeRestrictions.MinimumSize = new CGSize(600, 400); } }); }); #endif }); return builder.Build(); } } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,4 @@ // ******** WinUI3 Window management ******** // using Microsoft.Maui.LifecycleEvents; #if WINDOWS -
LanceMcCarthy created this gist
Apr 25, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,50 @@ using Microsoft.Maui.LifecycleEvents; #if WINDOWS using Microsoft.UI; using Microsoft.UI.Windowing; using Windows.Graphics; #endif namespace MyApp.Maui { public static class MauiProgram { public static MauiApp CreateMauiApp() { var builder = MauiApp.CreateBuilder(); builder .UseMauiApp<App>() .ConfigureFonts(fonts => { fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular"); fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold"); }); #if WINDOWS builder.ConfigureLifecycleEvents(events => { events.AddWindows(wndLifeCycleBuilder => { wndLifeCycleBuilder.OnWindowCreated(window => { IntPtr nativeWindowHandle = WinRT.Interop.WindowNative.GetWindowHandle(window); WindowId win32WindowsId = Win32Interop.GetWindowIdFromWindow(nativeWindowHandle); AppWindow winuiAppWindow = AppWindow.GetFromWindowId(win32WindowsId); // Hard coded logic to center window on a 1920x1080 display, adjust as needed const int width = 1200; const int height = 800; const int x = 1920 / 2 - width / 2; const int y = 1080 / 2 - height / 2; winuiAppWindow.MoveAndResize(new RectInt32(x, y, width, height)); }); }); }); #endif return builder.Build(); } } }