2026-01-17 07:52:05 +00:00
|
|
|
// App.xaml.cs - Main Application with Theme Support
|
2026-01-11 13:34:36 -05:00
|
|
|
|
|
|
|
|
using Microsoft.Maui.Controls;
|
|
|
|
|
|
|
|
|
|
namespace WebViewDemo;
|
|
|
|
|
|
|
|
|
|
public partial class App : Application
|
|
|
|
|
{
|
|
|
|
|
public App()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2026-01-17 05:42:44 +00:00
|
|
|
}
|
2026-01-11 13:34:36 -05:00
|
|
|
|
2026-01-17 05:42:44 +00:00
|
|
|
protected override Window CreateWindow(IActivationState? activationState)
|
|
|
|
|
{
|
2026-01-17 07:52:05 +00:00
|
|
|
return new Window(new WebViewPage())
|
2026-01-11 13:34:36 -05:00
|
|
|
{
|
2026-01-17 07:52:05 +00:00
|
|
|
Title = "OpenMaui Browser"
|
2026-01-11 13:34:36 -05:00
|
|
|
};
|
2026-01-17 07:52:05 +00:00
|
|
|
}
|
2026-01-11 13:34:36 -05:00
|
|
|
|
2026-01-17 07:52:05 +00:00
|
|
|
public static void ToggleTheme()
|
|
|
|
|
{
|
|
|
|
|
if (Current is null) return;
|
2026-01-11 13:34:36 -05:00
|
|
|
|
2026-01-17 07:52:05 +00:00
|
|
|
Current.UserAppTheme = Current.UserAppTheme == AppTheme.Dark
|
|
|
|
|
? AppTheme.Light
|
|
|
|
|
: AppTheme.Dark;
|
2026-01-11 13:34:36 -05:00
|
|
|
}
|
|
|
|
|
}
|