-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathMainPage.xaml.cs
61 lines (43 loc) · 1.26 KB
/
MainPage.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
55
56
57
58
59
60
61
using Sandbox;
using Sandbox.Views;
namespace MauiNet8;
public partial class MainPage : BasePage
{
int count = 0;
public List<MainPageVariant> ButtonsList { get; }
public MainPage()
{
try
{
ButtonsList = App.MainPages;
InitializeComponent();
BindingContext = new MainPageViewModel();
}
catch (Exception e)
{
Super.DisplayException(this, e);
}
}
protected override void OnAppearing()
{
base.OnAppearing();
#if ANDROID
//App.TestLink();
#endif
}
private void TappedSelectPage(object sender, SkiaGesturesParameters skiaGesturesParameters)
{
if (sender is SkiaButton btn)
{
var page = App.MainPages.FirstOrDefault(x => x.Name == btn.Text);
if (page != null)
{
Super.EnableRendering = false; //globally disable the rendering
//to avoid crash accessing memory when the old mainpage is destroyed
//but double buffered hw-accelerated view might try to render to it
var instance = (ContentPage)Activator.CreateInstance(page.Type);
App.Instance.SetMainPage(instance);
}
}
}
}