-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.xaml.cs
35 lines (29 loc) · 998 Bytes
/
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
using System.Diagnostics;
using System.Windows;
using CommunityToolkit.Mvvm.DependencyInjection;
using Esri.ArcGISRuntime;
using FollowEntity.ViewModel;
using Microsoft.Extensions.DependencyInjection;
namespace FollowEntity;
public partial class App : Application
{
public static MainViewModel MainViewModel => Ioc.Default.GetRequiredService<MainViewModel>();
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
try
{
// TODO: Set your API key here
// (Sign up at https://developers.arcgis.com/sign-up/ to get an API Key)
ArcGISRuntimeEnvironment.ApiKey = "YOUR_API_KEY";
ArcGISRuntimeEnvironment.Initialize();
Ioc.Default.ConfigureServices(new ServiceCollection()
.AddSingleton<MainViewModel>()
.BuildServiceProvider());
}
catch (InvalidOperationException ex)
{
Debug.WriteLine(ex);
}
}
}