-
Notifications
You must be signed in to change notification settings - Fork 531
Expand file tree
/
Copy pathAppShell.xaml.cs
More file actions
43 lines (34 loc) · 935 Bytes
/
AppShell.xaml.cs
File metadata and controls
43 lines (34 loc) · 935 Bytes
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
using ArcGIS.Samples.Managers;
using ArcGIS.Samples.Shared.Managers;
namespace ArcGIS;
public partial class AppShell : Shell
{
public AppShell()
{
InitializeComponent();
Initialize();
}
private void Initialize()
{
this.Appearing += FirstLoaded;
}
#region Check API Key
private void FirstLoaded(object sender, EventArgs e)
{
this.Appearing -= FirstLoaded;
SampleManager.Current.Initialize();
_ = CheckApiKey();
}
private async Task CheckApiKey()
{
// Attempt to load a locally stored API key.
await ApiKeyManager.TrySetLocalKey();
// Check that the current API key is valid.
ApiKeyStatus status = await ApiKeyManager.CheckKeyValidity();
if (status != ApiKeyStatus.Valid)
{
await Shell.Current.Navigation.PushAsync(new ApiKeyPage(), true);
}
}
#endregion
}