forked from microsoft/dotnet-podcasts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.xaml.cs
54 lines (43 loc) · 1.57 KB
/
App.xaml.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
51
52
53
54
using Application = Microsoft.Maui.Controls.Application;
namespace Microsoft.NetConf2021.Maui;
public partial class App : Application
{
public App()
{
InitializeComponent();
TheTheme.SetTheme();
if (Config.Desktop)
MainPage = new DesktopShell();
else
MainPage = new MobileShell();
Routing.RegisterRoute(nameof(DiscoverPage), typeof(DiscoverPage));
Routing.RegisterRoute(nameof(ShowDetailPage), typeof(ShowDetailPage));
Routing.RegisterRoute(nameof(EpisodeDetailPage), typeof(EpisodeDetailPage));
Routing.RegisterRoute(nameof(CategoriesPage), typeof(CategoriesPage));
Routing.RegisterRoute(nameof(CategoryPage), typeof(CategoryPage));
}
Window window;
protected override Window CreateWindow(IActivationState activationState)
{
window = base.CreateWindow(activationState);
if (DeviceInfo.Platform == DevicePlatform.WinUI ||
DeviceInfo.Platform == DevicePlatform.MacCatalyst)
{
window.MinimumWidth = 1080;
window.MaximumWidth = 1920;
window.MinimumHeight = 500;
window.MaximumHeight = 1080;
window.SizeChanged += Window_SizeChanged;
}
return window;
}
private void Window_SizeChanged(object sender, EventArgs e)
{
if (window is null)
return;
if (window.Width < 1200)
Shell.Current.FlyoutBehavior = FlyoutBehavior.Flyout;
else
Shell.Current.FlyoutBehavior = FlyoutBehavior.Locked;
}
}