LiveMapsPanel.xaml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <UserControl x:Class="PRSDesktop.LiveMapsPanel"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
  7. xmlns:dynamicGrid="clr-namespace:InABox.DynamicGrid;assembly=InABox.Wpf"
  8. xmlns:prsDesktop="clr-namespace:PRSDesktop"
  9. xmlns:dynamicGrid1="clr-namespace:InABox.Wpf.DynamicGrid;assembly=InABox.Wpf"
  10. xmlns:wpf="clr-namespace:InABox.Wpf;assembly=InABox.Wpf"
  11. xmlns:classes="clr-namespace:Comal.Classes;assembly=PRSClasses"
  12. mc:Ignorable="d"
  13. d:DesignHeight="450" d:DesignWidth="800">
  14. <UserControl.DataContext>
  15. <prsDesktop:LiveMapsPanelViewModel x:Name="ViewModel" />
  16. </UserControl.DataContext>
  17. <UserControl.Resources>
  18. <prsDesktop:TestConverter x:Key="TestConverter" />
  19. <prsDesktop:EquipmentThumbnailConverter x:Key="EquipmentThumbnailConverter" />
  20. <prsDesktop:EquipmentColorConverter x:Key="EquipmentColorConverter" />
  21. <prsDesktop:GeoFenceImageConverter x:Key="GeoFenceImageConverter" />
  22. <prsDesktop:MarkerAlignmentConverter x:Key="MarkerAlignmentConverter"/>
  23. <DataTemplate x:Key="AssetMarkerTemplate" DataType="{x:Type prsDesktop:AssetMapMarker}">
  24. <Border
  25. BorderBrush="Purple"
  26. BorderThickness="0.75"
  27. CornerRadius="10"
  28. Padding="2"
  29. Width="20"
  30. Height="20"
  31. Margin="-10,-10,10,10"
  32. >
  33. <Border.Background>
  34. <SolidColorBrush Color="Orchid" Opacity ="0.8" />
  35. </Border.Background>
  36. <Border.ToolTip>
  37. <Label Content ="{Binding Label}" />
  38. </Border.ToolTip>
  39. </Border>
  40. </DataTemplate>
  41. <DataTemplate x:Key="SiteMarkerTemplate" DataType="{x:Type prsDesktop:SiteMapMarker}">
  42. <Border
  43. BorderBrush="Gray"
  44. BorderThickness="0.75"
  45. CornerRadius="0,5,5,5"
  46. Padding="2">
  47. <Label Content ="{Binding Label}" />
  48. <Border.Background>
  49. <SolidColorBrush Color="LightYellow" Opacity ="0.8" />
  50. </Border.Background>
  51. </Border>
  52. </DataTemplate>
  53. <prsDesktop:MarkerTemplateSelector x:Key="markerTemplateSelector"
  54. SiteMarkerTemplate="{StaticResource SiteMarkerTemplate}"
  55. AssetMarkerTemplate="{StaticResource AssetMarkerTemplate}"/>
  56. <Style x:Key="EquipmentListBoxItemContainerStyle" TargetType="ListBoxItem">
  57. <Setter Property="Height" Value="50" />
  58. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  59. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  60. <Setter Property="Padding" Value="0,0,0,0" />
  61. <Setter Property="Margin" Value="-1" />
  62. </Style>
  63. <Style x:Key="SiteListBoxItemContainerStyle" TargetType="ListBoxItem">
  64. <Setter Property="Height" Value="60" />
  65. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  66. <Setter Property="VerticalContentAlignment" Value="Stretch" />
  67. <Setter Property="Padding" Value="0,0,0,0" />
  68. <Setter Property="Margin" Value="-1" />
  69. </Style>
  70. <DataTemplate x:Key="EquipmentListBoxItemTemplate" DataType="{x:Type classes:Equipment}">
  71. <Grid>
  72. <Grid.Background>
  73. <SolidColorBrush
  74. Opacity="0.5"
  75. Color="{Binding ., Converter={StaticResource EquipmentColorConverter}}" />
  76. </Grid.Background>
  77. <Grid.ColumnDefinitions>
  78. <ColumnDefinition Width="50"/>
  79. <ColumnDefinition Width="Auto"/>
  80. <ColumnDefinition Width="*"/>
  81. <ColumnDefinition Width="Auto"/>
  82. </Grid.ColumnDefinitions>
  83. <Grid.RowDefinitions>
  84. <RowDefinition Height="*"/>
  85. <RowDefinition Height="*"/>
  86. <RowDefinition Height="Auto"/>
  87. </Grid.RowDefinitions>
  88. <Image
  89. Grid.Row="0"
  90. Grid.Column="0"
  91. Grid.RowSpan="2"
  92. Margin="5"
  93. Source="{Binding GroupLink.Thumbnail.ID, Converter={StaticResource EquipmentThumbnailConverter}}"
  94. VerticalAlignment="Center"
  95. HorizontalAlignment="Center"/>
  96. <Label
  97. Grid.Row="0"
  98. Grid.Column="1"
  99. Grid.ColumnSpan="3"
  100. Content="{Binding Description}"
  101. FontWeight="DemiBold"/>
  102. <Label
  103. Grid.Row="1"
  104. Grid.Column="1"
  105. Content="{Binding Code}"/>
  106. <Label
  107. Grid.Row="1"
  108. Grid.Column="2"
  109. HorizontalContentAlignment="Center"
  110. Content="{Binding TrackerLink.Location.Timestamp}"
  111. ContentStringFormat="{}{0:dd-MMM-yy}"/>
  112. <Label
  113. Grid.Row="1"
  114. Grid.Column="3"
  115. Content="{Binding TrackerLink.DeviceID}"/>
  116. <Border
  117. Grid.Row="2"
  118. Grid.Column="0"
  119. Grid.ColumnSpan="4"
  120. BorderThickness="0,0.75,0,0"
  121. BorderBrush="Gray"
  122. Margin="0"
  123. Padding="0"
  124. Height="0.75"/>
  125. </Grid>
  126. </DataTemplate>
  127. <DataTemplate x:Key="SiteListBoxItemTemplate" DataType="{x:Type classes:GeoFence}">
  128. <Grid>
  129. <Grid.Background>
  130. <SolidColorBrush Opacity="0.5" Color="LightYellow" />
  131. </Grid.Background>
  132. <Grid.ColumnDefinitions>
  133. <ColumnDefinition Width="60"/>
  134. <ColumnDefinition Width="*"/>
  135. </Grid.ColumnDefinitions>
  136. <Grid.RowDefinitions>
  137. <RowDefinition Height="Auto"/>
  138. <RowDefinition Height="*"/>
  139. <RowDefinition Height="Auto"/>
  140. <RowDefinition Height="Auto"/>
  141. </Grid.RowDefinitions>
  142. <Image
  143. Grid.Row="0"
  144. Grid.Column="0"
  145. Grid.RowSpan="3"
  146. Margin="10"
  147. Source="{Binding Type, Converter={StaticResource GeoFenceImageConverter}}"
  148. VerticalAlignment="Center"
  149. HorizontalAlignment="Center"/>
  150. <TextBlock
  151. Grid.Row="0"
  152. Grid.Column="1"
  153. FontWeight="DemiBold">
  154. <Run Text="{Binding Code}" />
  155. <Run Text=" - " />
  156. <Run Text="{Binding Name}" />
  157. </TextBlock>
  158. <TextBlock
  159. Grid.Row="1"
  160. Grid.Column="1"
  161. VerticalAlignment="Center">
  162. <Run Text="{Binding Street}"/>
  163. </TextBlock>
  164. <TextBlock
  165. Grid.Row="2"
  166. Grid.Column="1">
  167. <Run Text="{Binding City}"/>
  168. <Run Text="{Binding State}"/>
  169. <Run Text="{Binding PostCode}"/>
  170. </TextBlock>
  171. <Border
  172. Grid.Row="3"
  173. Grid.Column="0"
  174. Grid.ColumnSpan="2"
  175. BorderThickness="0,0.75,0,0"
  176. BorderBrush="Gray"
  177. Margin="0"
  178. Padding="0"
  179. Height="0.75"/>
  180. </Grid>
  181. </DataTemplate>
  182. </UserControl.Resources>
  183. <dynamicGrid:DynamicSplitPanel
  184. View="Combined"
  185. AllowableViews="Combined"
  186. Anchor="Master"
  187. AnchorWidth="300"
  188. >
  189. <dynamicGrid:DynamicSplitPanel.Master>
  190. <DockPanel>
  191. <ComboBox
  192. DockPanel.Dock="Top"
  193. x:Name="ViewSites"
  194. Padding="5"
  195. VerticalContentAlignment="Center"
  196. ItemsSource="{Binding SiteTypes}"
  197. SelectedItem="{Binding SelectedSiteType, Mode=TwoWay}"
  198. SelectedValuePath="Item1"
  199. DisplayMemberPath="Item2" />
  200. <TextBox
  201. DockPanel.Dock="Top"
  202. x:Name="SearchSites"
  203. Background="LightYellow"
  204. Padding="5"
  205. Margin="0,4,0,0"
  206. HorizontalContentAlignment="Left"
  207. VerticalContentAlignment="Center"
  208. wpf:TextBoxUtils.Placeholder="Search Sites"
  209. Text="{Binding EquipmentSearch, Mode=TwoWay}"/>
  210. <ListBox
  211. DockPanel.Dock="Top"
  212. Margin="0,4,0,0"
  213. ItemsSource="{Binding VisibleSites}"
  214. BorderThickness="0.75"
  215. BorderBrush="Gray"
  216. SelectedItem="{Binding SelectedSite, Mode=TwoWay}"
  217. Padding="0"
  218. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  219. ScrollViewer.VerticalScrollBarVisibility="Auto"
  220. ItemContainerStyle="{StaticResource SiteListBoxItemContainerStyle}"
  221. ItemTemplate="{StaticResource SiteListBoxItemTemplate}"/>
  222. </DockPanel>
  223. </dynamicGrid:DynamicSplitPanel.Master>
  224. <dynamicGrid:DynamicSplitPanel.Detail>
  225. <dynamicGrid:DynamicSplitPanel
  226. View="Combined"
  227. AllowableViews="Combined"
  228. Anchor="Detail"
  229. AnchorWidth="300"
  230. >
  231. <dynamicGrid:DynamicSplitPanel.Master>
  232. <syncfusion:SfMap
  233. x:Name="Map"
  234. Grid.Column="1"
  235. Grid.Row="0"
  236. BorderBrush="Gray"
  237. BorderThickness="0.75"
  238. ZoomedIn="Map_OnZoomed"
  239. ZoomedOut="Map_OnZoomed"
  240. Panned="Map_OnPanned"
  241. >
  242. <syncfusion:SfMap.Layers>
  243. <syncfusion:ImageryLayer
  244. x:Name="ImageryLayer"
  245. Center="{Binding Center, Mode=TwoWay}"
  246. Radius="{Binding Radius, Mode=TwoWay}"
  247. DistanceType="KiloMeter"
  248. Markers="{Binding Markers, Mode=TwoWay}"
  249. MarkerTemplateSelector="{StaticResource markerTemplateSelector}"
  250. MarkerHorizontalAlignment="Far"
  251. MarkerVerticalAlignment="Far">
  252. <syncfusion:ImageryLayer.SubShapeFileLayers>
  253. <syncfusion:SubShapeFileLayer
  254. MapElements="{Binding Elements}" >
  255. </syncfusion:SubShapeFileLayer>
  256. </syncfusion:ImageryLayer.SubShapeFileLayers>
  257. </syncfusion:ImageryLayer>
  258. </syncfusion:SfMap.Layers>
  259. </syncfusion:SfMap>
  260. </dynamicGrid:DynamicSplitPanel.Master>
  261. <dynamicGrid:DynamicSplitPanel.Detail>
  262. <DockPanel>
  263. <ComboBox
  264. DockPanel.Dock="Top"
  265. x:Name="ViewGroup"
  266. Padding="5"
  267. VerticalContentAlignment="Center"
  268. ItemsSource="{Binding EquipmentGroups}"
  269. SelectedItem="{Binding SelectedEquipmentGroup, Mode=TwoWay}"
  270. DisplayMemberPath="Description" />
  271. <TextBox
  272. DockPanel.Dock="Top"
  273. x:Name="SearchAssets"
  274. Background="LightYellow"
  275. Padding="5"
  276. Margin="0,4,0,0"
  277. HorizontalContentAlignment="Left"
  278. VerticalContentAlignment="Center"
  279. wpf:TextBoxUtils.Placeholder="Search"
  280. Text="{Binding EquipmentSearch, Mode=TwoWay}"/>
  281. <Border
  282. DockPanel.Dock="Top"
  283. BorderBrush="Gray"
  284. BorderThickness="0.75"
  285. Margin="0,4,0,0"
  286. Background="White">
  287. <syncfusion:CalendarEdit
  288. x:Name="Date"
  289. ShowAbbreviatedMonthNames="True"
  290. AllowMultiplySelection="False"
  291. Date="{Binding Date, Mode=TwoWay}"
  292. BorderBrush="Transparent" />
  293. </Border>
  294. <ListBox
  295. x:Name="Markers"
  296. DockPanel.Dock="Top"
  297. Margin="0,4,0,0"
  298. ItemsSource="{Binding VisibleEquipment}"
  299. BorderThickness="0.75"
  300. SelectedItem="{Binding SelectedEquipment, Mode=TwoWay}"
  301. Padding="0"
  302. ScrollViewer.HorizontalScrollBarVisibility="Disabled"
  303. ScrollViewer.VerticalScrollBarVisibility="Auto"
  304. ItemContainerStyle="{StaticResource EquipmentListBoxItemContainerStyle}"
  305. ItemTemplate="{StaticResource EquipmentListBoxItemTemplate}" />
  306. </DockPanel>
  307. </dynamicGrid:DynamicSplitPanel.Detail>
  308. </dynamicGrid:DynamicSplitPanel>
  309. </dynamicGrid:DynamicSplitPanel.Detail>
  310. </dynamicGrid:DynamicSplitPanel>
  311. </UserControl>