-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathApp.xaml.cs
More file actions
83 lines (64 loc) · 2.3 KB
/
App.xaml.cs
File metadata and controls
83 lines (64 loc) · 2.3 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
using ESP32_Android_Controller.ViewModels;
using Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;
namespace ESP32_Android_Controller;
public delegate void PermissionsResultReady(object sender, EventArgs e);
public partial class App : Microsoft.Maui.Controls.Application
{
public bool HasPermissions { get; set; } = false;
private int statusBarHeight = 0;
public int StatusBarHeight
{
get => this.statusBarHeight;
set
{
this.statusBarHeight = value;
OnPropertyChanged("StatusBarHeight");
this.HeaderPadding = new Thickness(0, this.StatusBarHeight, 0, 0);
}
}
public Thickness HeaderPadding
{
get { return (Thickness)GetValue(HeaderPaddingProperty); }
set { SetValue(HeaderPaddingProperty, value); }
}
public static readonly BindableProperty HeaderPaddingProperty =
BindableProperty.Create("HeaderPadding", typeof(Thickness), typeof(App), new Thickness(0));
public App()
{
InitializeComponent();
AssignStyles();
MainPage = new AppShell();
//MainPage = new NavigationPage(new MainPage());
Current.On<Microsoft.Maui.Controls.PlatformConfiguration.Android>().UseWindowSoftInputModeAdjust(WindowSoftInputModeAdjust.Resize);
}
private ResourceDictionary customStyles = null;
void AssignStyles()
{
bool isSmall = AppShellModel.Instance.ScreenDensity > Constants.STYLES_BREAKPOINT_0;
customStyles = new ResourceDictionary();
if (isSmall)
{
customStyles.LoadFromXaml(typeof(Styles_sm));
Resources.MergedDictionaries.Add(customStyles);
}
else
{
customStyles.LoadFromXaml(typeof(Styles_lg));
Resources.Add(customStyles);
}
}
protected override Window CreateWindow(IActivationState activationState)
{
AppShellModel.Instance.SetCommMethod();
return base.CreateWindow(activationState);
}
public event PermissionsResultReady PermissionsReadyEvent;
public void FirePermissionsReadyEvent()
{
if (this.PermissionsReadyEvent != null)
{
this.PermissionsReadyEvent(null, EventArgs.Empty);
}
}
public SettingsPage SettingsPage { get; set; } = null;
}