-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathIndex.razor
More file actions
57 lines (45 loc) · 2.36 KB
/
Index.razor
File metadata and controls
57 lines (45 loc) · 2.36 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
@page "/Indoor"
@rendermode InteractiveServer
@using AzureMapsControl.Components.Map
@using Microsoft.Extensions.Configuration
@inject AzureMapsControl.Components.Indoor.IIndoorService IndoorService
@inject IConfiguration Configuration
<AzureMap Id="map"
CameraOptions="new CameraOptions { Center= new AzureMapsControl.Components.Atlas.Position(-122.13214, 47.63647), Zoom = 19 }"
StyleOptions="new StyleOptions { Style = MapStyle.Blank }"
EventActivationFlags="AzureMapsControl.Components.Map.MapEventActivationFlags.None().Enable(AzureMapsControl.Components.Map.MapEventType.Ready, AzureMapsControl.Components.Map.MapEventType.Click)"
OnReady="OnMapReadyAsync" />
@code {
public async Task OnMapReadyAsync(MapEventArgs eventArgs)
{
var levelControl = new AzureMapsControl.Components.Indoor.LevelControl(new AzureMapsControl.Components.Indoor.LevelControlOptions
{
Position = AzureMapsControl.Components.Controls.ControlPosition.TopRight
});
var statesetId = Configuration["Indoor:StatesetId"];
var options = new AzureMapsControl.Components.Indoor.IndoorManagerOptions
{
Geography = Configuration["AzureMaps:Geography"],
LevelControl = levelControl,
StatesetId = statesetId,
TilesetId = Configuration["Indoor:TilesetId"]
};
var indoorManager = await IndoorService.CreateIndoorManagerAsync(eventArgs.Map.Id, options, AzureMapsControl.Components.Indoor.IndoorManagerEventActivationFlags.All());
indoorManager.OnFacilityChanged += eventArgs =>
{
Console.WriteLine("OnFacilityChanged");
Console.WriteLine($"Switched facility from {eventArgs.PrevFacilityId} to {eventArgs.FacilityId}");
Console.WriteLine($"Switched level from {eventArgs.PrevLevelNumber} to {eventArgs.LevelNumber}");
};
indoorManager.OnLevelChanged += eventArgs =>
{
Console.WriteLine("OnLevelChanged");
Console.WriteLine($"Switched facility from {eventArgs.PrevFacilityId} to {eventArgs.FacilityId}");
Console.WriteLine($"Switched level from {eventArgs.PrevLevelNumber} to {eventArgs.LevelNumber}");
};
if (!string.IsNullOrWhiteSpace(statesetId))
{
await indoorManager.SetDynamicStylingAsync(true);
}
}
}