forked from atsamd21/Haveno-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainPage.xaml.cs
More file actions
55 lines (46 loc) · 1.34 KB
/
MainPage.xaml.cs
File metadata and controls
55 lines (46 loc) · 1.34 KB
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
55
using Microsoft.AspNetCore.Components.WebView.Maui;
namespace Manta;
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
protected override void OnHandlerChanged()
{
base.OnHandlerChanged();
#if ANDROID
var platformView = (Android.Webkit.WebView?)blazorWebView.Handler?.PlatformView;
if (platformView is not null)
platformView.OverScrollMode = Android.Views.OverScrollMode.Never;
#endif
}
protected override void OnAppearing()
{
base.OnAppearing();
if (stackLayout.Children.Count == 0)
{
blazorWebView = new()
{
HostPage = "wwwroot/index.html",
HorizontalOptions = LayoutOptions.FillAndExpand,
VerticalOptions = LayoutOptions.FillAndExpand,
};
RootComponent rootComponent = new()
{
Selector = "#app",
ComponentType = typeof(Components.Routes),
};
blazorWebView.RootComponents.Add(rootComponent);
stackLayout.Children.Add(blazorWebView);
}
}
protected override void OnDisappearing()
{
if (!Navigation.ModalStack.Any())
{
stackLayout.Children.Remove(blazorWebView);
}
base.OnDisappearing();
}
}