-
Notifications
You must be signed in to change notification settings - Fork 0
/
MauiProgram.cs
50 lines (44 loc) · 1.75 KB
/
MauiProgram.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using Microsoft.Extensions.Logging;
using Microsoft.Maui.LifecycleEvents;
namespace MicaBackdropMAUI
{
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 DEBUG
builder.Logging.AddDebug();
#endif
#if WINDOWS
builder.ConfigureLifecycleEvents(lifecycle => {
lifecycle.AddWindows(wndLifeCycleBuilder =>
{
wndLifeCycleBuilder.OnWindowCreated((window) =>
{
window.ExtendsContentIntoTitleBar = true;
window.SystemBackdrop = new Microsoft.UI.Xaml.Media.MicaBackdrop() { Kind = Microsoft.UI.Composition.SystemBackdrops.MicaKind.BaseAlt };
//var handle = WinRT.Interop.WindowNative.GetWindowHandle(window);
//var id = Microsoft.UI.Win32Interop.GetWindowIdFromWindow(handle);
//var appWindow = Microsoft.UI.Windowing.AppWindow.GetFromWindowId(id);
//switch (appWindow.Presenter)
//{
// case Microsoft.UI.Windowing.OverlappedPresenter overlappedPresenter:
// overlappedPresenter.Maximize();
// break;
//}
});
});
});
#endif
return builder.Build();
}
}
}