-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
94 lines (87 loc) · 5.85 KB
/
MainWindow.xaml
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
84
85
86
87
88
89
90
91
92
93
94
<Window x:Class="FollowEntity.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:behaviors="http://schemas.microsoft.com/xaml/behaviors"
xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
xmlns:converter="clr-namespace:FollowEntity.Converter"
xmlns:vm="clr-namespace:FollowEntity.ViewModel"
xmlns:local="clr-namespace:FollowEntity"
mc:Ignorable="d" d:DataContext="{d:DesignInstance vm:MainViewModel}"
DataContext="{Binding MainViewModel, Source={x:Static Application.Current}}"
Title="Follow Entity Simulation">
<DockPanel>
<!-- Top panel for UI -->
<Border DockPanel.Dock="Top" BorderBrush="Black" BorderThickness="0,0,0,2">
<DockPanel Background="LightGray">
<StackPanel DockPanel.Dock="Left" Background="LightGray">
<TextBlock Text="Delivery" FontSize="18" FontWeight="Bold" Padding="12,4" VerticalAlignment="Center" HorizontalAlignment="Center" />
<TextBlock Text="Simulator" FontSize="18" FontWeight="Bold" Padding="12,4" VerticalAlignment="Center" HorizontalAlignment="Center" />
</StackPanel>
<DockPanel DockPanel.Dock="Right" Margin="12,0" VerticalAlignment="Center">
<TextBlock DockPanel.Dock="Top" Text="Simulation Speed" FontWeight="SemiBold" Margin="0,0,0,6" HorizontalAlignment="Center"/>
<Slider Width="200" Minimum="1" Maximum="10" TickFrequency="1" TickPlacement="BottomRight"
Value="{Binding SimulationSource.SpeedAdjustment, Mode=TwoWay}" />
</DockPanel>
<DockPanel>
<StackPanel DockPanel.Dock="Left" Margin="8,0,0,0">
<TextBlock Text="Follow Options" FontWeight="Bold" />
<RadioButton Content="Manual" GroupName="FollowOptionsGroup" Margin="2,1" IsChecked="True"
Command="{Binding FollowModeChangedCommand}" CommandParameter="{x:Static vm:FollowMode.Manual}" />
<RadioButton Content="LocationDataSource" GroupName="FollowOptionsGroup" Margin="2,1"
Command="{Binding FollowModeChangedCommand}" CommandParameter="{x:Static vm:FollowMode.LocationDataSource}" />
<RadioButton Content="CameraController" GroupName="FollowOptionsGroup" Margin="2,1"
Command="{Binding FollowModeChangedCommand}" CommandParameter="{x:Static vm:FollowMode.CameraController}" />
</StackPanel>
<StackPanel HorizontalAlignment="Center"
Visibility="{Binding SelectedEntity, Converter={converter:NullToVisibilityConverter}}">
<TextBlock Text="Selected Route" FontWeight="Bold" FontSize="14" Margin="0,0,0,2"/>
<DockPanel Margin="8,0,0,0">
<TextBlock Text="Route ID: " />
<TextBlock Text="{Binding SelectedEntity.EntityId}" FontWeight="Bold"/>
</DockPanel>
<DockPanel Margin="8,0,0,0">
<TextBlock Text="Truck: " />
<TextBlock Text="{Binding SelectedEntity.Attributes[Id]}" FontWeight="Bold"/>
</DockPanel>
</StackPanel>
</DockPanel>
</DockPanel>
</Border>
<!-- Switch between MapView and SceneView -->
<Grid>
<Grid.Resources>
<DataTemplate x:Key="MapViewTemplate">
<esri:MapView Map="{Binding GeoModel}" esri:GeoViewController.GeoViewController="{Binding FollowEntityController}">
<behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="GeoViewTapped">
<behaviors:InvokeCommandAction Command="{Binding GeoViewTappedCommand}" PassEventArgsToCommand="True" />
</behaviors:EventTrigger>
</behaviors:Interaction.Triggers>
</esri:MapView>
</DataTemplate>
<DataTemplate x:Key="SceneViewTemplate">
<esri:SceneView Scene="{Binding GeoModel}" esri:GeoViewController.GeoViewController="{Binding FollowEntityController}">
<behaviors:Interaction.Triggers>
<behaviors:EventTrigger EventName="GeoViewTapped">
<behaviors:InvokeCommandAction Command="{Binding GeoViewTappedCommand}" PassEventArgsToCommand="True" />
</behaviors:EventTrigger>
</behaviors:Interaction.Triggers>
</esri:SceneView>
</DataTemplate>
<Style x:Key="GeoViewContentStyle" TargetType="ContentControl">
<Style.Triggers>
<DataTrigger Binding="{Binding IsSceneView}" Value="true">
<Setter Property="ContentTemplate" Value="{StaticResource SceneViewTemplate}" />
</DataTrigger>
<DataTrigger Binding="{Binding IsSceneView}" Value="false">
<Setter Property="ContentTemplate" Value="{StaticResource MapViewTemplate}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Grid.Resources>
<ContentControl Content="{Binding}" Style="{StaticResource GeoViewContentStyle}" />
</Grid>
</DockPanel>
</Window>