DriveServoView.xaml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <UserControl x:Class="OHV.Module.Interactivity.PopUp.DriveServoView"
  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:local="clr-namespace:OHV.Module.Interactivity.PopUp"
  7. xmlns:prism="http://prismlibrary.com/"
  8. xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
  9. prism:ViewModelLocator.AutoWireViewModel="True"
  10. mc:Ignorable="d"
  11. Width="1130"
  12. Height="700"
  13. Background="#455a64">
  14. <prism:Dialog.WindowStyle>
  15. <Style TargetType="Window">
  16. <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterScreen" />
  17. <Setter Property="Background" Value="Transparent"/>
  18. <Setter Property="AllowsTransparency" Value="True"/>
  19. <Setter Property="ResizeMode" Value="NoResize"/>
  20. <Setter Property="WindowStyle" Value="None"/>
  21. <Setter Property="BorderThickness" Value="1"/>
  22. <Setter Property="BorderBrush" Value="{DynamicResource BorderSolidNormal}"/>
  23. <Setter Property="Template" Value="{DynamicResource WindowTemplateKey}"/>
  24. <!--<Style.Triggers>
  25. <Trigger Property="ResizeMode" Value="CanResizeWithGrip">
  26. <Setter Property="Template" Value="{StaticResource WindowTemplateKey}"/>
  27. </Trigger>
  28. </Style.Triggers>-->
  29. </Style>
  30. </prism:Dialog.WindowStyle>
  31. <UserControl.Resources>
  32. <Style x:Key="MaterialDesignDataGridRowHeader" TargetType="{x:Type DataGridRowHeader}">
  33. <Setter Property="Template">
  34. <Setter.Value>
  35. <ControlTemplate TargetType="{x:Type DataGridRowHeader}">
  36. <Grid MinWidth="24">
  37. <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}">
  38. <StackPanel Orientation="Horizontal">
  39. <ContentPresenter RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="Center"/>
  40. <Control SnapsToDevicePixels="false" Template="{Binding ValidationErrorTemplate, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}" Visibility="{Binding (Validation.HasError), Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource AncestorType={x:Type DataGridRow}}}"/>
  41. </StackPanel>
  42. </Border>
  43. <Thumb x:Name="PART_TopHeaderGripper" Style="{StaticResource MaterialDesignGridRowHeaderGripper}" VerticalAlignment="Top"/>
  44. <Thumb x:Name="PART_BottomHeaderGripper" Style="{StaticResource MaterialDesignGridRowHeaderGripper}" VerticalAlignment="Bottom"/>
  45. </Grid>
  46. </ControlTemplate>
  47. </Setter.Value>
  48. </Setter>
  49. </Style>
  50. </UserControl.Resources>
  51. <Grid>
  52. <Grid.ColumnDefinitions>
  53. <ColumnDefinition/>
  54. <ColumnDefinition Width="130"/>
  55. <ColumnDefinition Width="130"/>
  56. </Grid.ColumnDefinitions>
  57. <Grid Grid.Column="0" Margin="15"
  58. Background="#37474f">
  59. <Grid.RowDefinitions>
  60. <RowDefinition Height="*"/>
  61. <RowDefinition Height="*"/>
  62. </Grid.RowDefinitions>
  63. <!--Position Data Grid View-->
  64. <Grid Grid.Row="0">
  65. <DataGrid
  66. Margin="15"
  67. ItemsSource="{Binding POS}"
  68. CanUserSortColumns="True"
  69. CanUserAddRows="False"
  70. Background="{x:Null}"
  71. Width="auto"
  72. Height="auto"
  73. BorderBrush="#FF00FFD3"
  74. BorderThickness="1"
  75. SelectedItem="{Binding SelectedRow1}">
  76. <DataGrid.ColumnHeaderStyle>
  77. <Style TargetType="DataGridColumnHeader">
  78. <Setter Property="BorderBrush" Value="#FF00FFD3"/>
  79. <Setter Property="Foreground" Value="White"/>
  80. <Setter Property="FontSize" Value="20"/>
  81. <Setter Property="HorizontalAlignment" Value="Center"/>
  82. <Setter Property="VerticalAlignment" Value="Center"/>
  83. </Style>
  84. </DataGrid.ColumnHeaderStyle>
  85. <DataGrid.CellStyle>
  86. <Style TargetType="DataGridCell">
  87. <Setter Property="TextBlock.TextAlignment" Value="Center"/>
  88. <Setter Property="TextBlock.FontStretch" Value="UltraExpanded"/>
  89. <Setter Property="TextBlock.VerticalAlignment" Value="Center"/>
  90. <Setter Property="BorderBrush" Value="Black"/>
  91. <Setter Property="Foreground" Value="White"/>
  92. <Setter Property="FontSize" Value="15"/>
  93. <Setter Property="Width" Value="161"/>
  94. <Setter Property="Height" Value="50"/>
  95. </Style>
  96. </DataGrid.CellStyle>
  97. </DataGrid>
  98. </Grid>
  99. <!--Axis Grid View-->
  100. <Grid Grid.Row="1">
  101. <Grid.RowDefinitions>
  102. <RowDefinition Height="*"/>
  103. <RowDefinition Height="*"/>
  104. <RowDefinition Height="*"/>
  105. <RowDefinition Height="*"/>
  106. </Grid.RowDefinitions>
  107. <Grid.ColumnDefinitions>
  108. <ColumnDefinition Width="*"/>
  109. <ColumnDefinition Width="*"/>
  110. <ColumnDefinition Width="*"/>
  111. <ColumnDefinition Width="*"/>
  112. <ColumnDefinition Width="*"/>
  113. </Grid.ColumnDefinitions>
  114. <Border Margin="0,5,163,5" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.RowSpan="4" Grid.Column="2"/>
  115. <Border Margin="161,5,2,3" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.RowSpan="2" Grid.Column="2" Grid.Row="2"/>
  116. <Border Margin="161,0,10,78" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Column="2" Grid.ColumnSpan="3" Grid.Row="2"/>
  117. <Border Margin="33,-2,34,82" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Grid.Column="2" Grid.ColumnSpan="3" Grid.RowSpan="2"/>
  118. <Button Grid.Column="0" Grid.Row="1" HorizontalAlignment="Stretch" Margin="5" Height="auto"
  119. Style="{StaticResource MaterialDesignRaisedButton}"
  120. materialDesign:ButtonAssist.CornerRadius="10"
  121. ToolTip="MaterialDesignRaisedButton with Round Corners">
  122. <StackPanel>
  123. <TextBlock HorizontalAlignment="Center"><Run Text="Target"/></TextBlock>
  124. <TextBlock HorizontalAlignment="Center"><Run Text="Pos"/></TextBlock>
  125. </StackPanel>
  126. </Button>
  127. <Button Grid.Column="0" Grid.Row="2" HorizontalAlignment="Stretch" Margin="5" Height="auto"
  128. Style="{StaticResource MaterialDesignRaisedButton}"
  129. materialDesign:ButtonAssist.CornerRadius="10"
  130. ToolTip="MaterialDesignRaisedButton with Round Corners">
  131. <StackPanel>
  132. <TextBlock HorizontalAlignment="Center"><Run Text="Current"/></TextBlock>
  133. <TextBlock HorizontalAlignment="Center"><Run Text="Pos"/></TextBlock>
  134. </StackPanel>
  135. </Button>
  136. <Button Grid.Column="0" Grid.Row="3" HorizontalAlignment="Stretch" Margin="5" Height="auto"
  137. Style="{StaticResource MaterialDesignRaisedButton}"
  138. materialDesign:ButtonAssist.CornerRadius="10"
  139. ToolTip="MaterialDesignRaisedButton with Round Corners">
  140. <StackPanel>
  141. <TextBlock HorizontalAlignment="Center"><Run Text="Difference"/></TextBlock>
  142. <TextBlock HorizontalAlignment="Center"><Run Text="Pos"/></TextBlock>
  143. </StackPanel>
  144. </Button>
  145. <Button Grid.Column="1" Grid.Row="0" HorizontalAlignment="Stretch" Margin="5" Height="auto"
  146. Style="{StaticResource MaterialDesignRaisedButton}"
  147. materialDesign:ButtonAssist.CornerRadius="10"
  148. ToolTip="MaterialDesignRaisedButton with Round Corners"
  149. Command="{Binding SelectAxisCommand}"
  150. CommandParameter="Left">
  151. <TextBlock><Run Text="Drive1"/></TextBlock>
  152. </Button>
  153. <Button Background="{x:Null}" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Stretch" Margin="5" Height="auto"
  154. Style="{StaticResource MaterialDesignRaisedButton}"
  155. materialDesign:ButtonAssist.CornerRadius="10"
  156. ToolTip="MaterialDesignRaisedButton with Round Corners">
  157. <Button.InputBindings>
  158. <MouseBinding Gesture="LeftClick" Command="{Binding KeyInTargetPosCommand}" CommandParameter="Left"/>
  159. </Button.InputBindings>
  160. <TextBlock><Run Text="{Binding TargetPosDrive, StringFormat=0.000, FallbackValue=0.000}"/></TextBlock>
  161. </Button>
  162. <Button Background="{x:Null}" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Stretch" Margin="5" Height="auto"
  163. Style="{StaticResource MaterialDesignRaisedButton}"
  164. materialDesign:ButtonAssist.CornerRadius="10"
  165. ToolTip="MaterialDesignRaisedButton with Round Corners">
  166. <TextBlock><Run Text="{Binding CurrentDrive, StringFormat=0.000, FallbackValue=0.000}"/></TextBlock>
  167. </Button>
  168. <Button Background="{x:Null}" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Stretch" Margin="5" Height="auto"
  169. Style="{StaticResource MaterialDesignRaisedButton}"
  170. materialDesign:ButtonAssist.CornerRadius="10"
  171. ToolTip="MaterialDesignRaisedButton with Round Corners">
  172. <TextBlock><Run Text="{Binding DifferenceDrive, StringFormat=0.000, FallbackValue=0.000}"/></TextBlock>
  173. </Button>
  174. <!--Steering Dir Front-->
  175. <Button Grid.Column="3" Margin="10"
  176. Grid.Row="2"
  177. HorizontalAlignment="Stretch"
  178. Height="Auto"
  179. BorderBrush="Gray"
  180. BorderThickness="2"
  181. Command="{Binding SelectedDirection}"
  182. CommandParameter="Front">
  183. <StackPanel>
  184. <!--<materialDesign:PackIcon Kind="SubdirectoryArrowLeft" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
  185. <TextBlock Text="Steering" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  186. <TextBlock Text="Front" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  187. </StackPanel>
  188. </Button>
  189. <!--Steering Dir Back-->
  190. <Button Grid.Column="4" Margin="10"
  191. Grid.Row="2"
  192. HorizontalAlignment="Stretch"
  193. Height="Auto"
  194. BorderBrush="Gray"
  195. BorderThickness="2"
  196. Command="{Binding SelectedDirection}"
  197. CommandParameter="Back">
  198. <StackPanel>
  199. <!--<materialDesign:PackIcon Kind="SubdirectoryArrowLeft" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
  200. <TextBlock Text="Steering" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  201. <TextBlock Text="Back" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  202. </StackPanel>
  203. </Button>
  204. <Button Grid.Column="3" Margin="3"
  205. Grid.Row="3"
  206. HorizontalAlignment="Stretch"
  207. Height="Auto"
  208. BorderBrush="Gray"
  209. BorderThickness="2"
  210. Command="{Binding SteeringCWCommand}"
  211. CommandParameter="CW">
  212. <StackPanel>
  213. <materialDesign:PackIcon Kind="SubdirectoryArrowLeft" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
  214. <TextBlock Text="Steering CW" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  215. </StackPanel>
  216. </Button>
  217. <Button Grid.Column="4" Margin="3"
  218. Grid.Row="3"
  219. HorizontalAlignment="Stretch"
  220. Height="Auto"
  221. BorderBrush="Gray"
  222. BorderThickness="2"
  223. Command="{Binding SteeringCCWCommand}"
  224. CommandParameter="CCW">
  225. <StackPanel>
  226. <materialDesign:PackIcon Kind="SubdirectoryArrowRight" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
  227. <TextBlock Text="Steering CCW" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  228. </StackPanel>
  229. </Button>
  230. <!--Jog Button-->
  231. <RepeatButton
  232. Margin="5"
  233. Grid.Row="0"
  234. Grid.Column="2"
  235. HorizontalAlignment="Right"
  236. Width="120"
  237. Height="auto"
  238. Command="{Binding JogCommand}" CommandParameter="-">
  239. <StackPanel>
  240. <materialDesign:PackIcon Kind="ArrowLeftBoldCircleOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto"/>
  241. <TextBlock><Run Text="Jog(-)"/></TextBlock>
  242. </StackPanel>
  243. </RepeatButton>
  244. <Button
  245. Margin="5"
  246. Grid.Row="0"
  247. Grid.Column="3"
  248. HorizontalAlignment="Center"
  249. Height="auto"
  250. Command="{Binding JogVelPopupCommand}" CommandParameter="-">
  251. <StackPanel>
  252. <TextBlock HorizontalAlignment="Center"><Run Text="Jog Velocity"/></TextBlock>
  253. <TextBlock HorizontalAlignment="Center"><Run Text="{Binding JogVelocity, StringFormat={}{0:0.000}, FallbackValue=0.000}"/></TextBlock>
  254. </StackPanel>
  255. </Button>
  256. <RepeatButton
  257. Margin="5"
  258. Grid.Row="0"
  259. Grid.Column="4"
  260. HorizontalAlignment="Left"
  261. Width="120"
  262. Height="auto"
  263. Command="{Binding JogCommand}" CommandParameter="+">
  264. <StackPanel>
  265. <materialDesign:PackIcon Kind="ArrowRightBoldCircleOutline" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="30" Width="auto"/>
  266. <TextBlock><Run Text="Jog(+)"/></TextBlock>
  267. </StackPanel>
  268. </RepeatButton>
  269. </Grid>
  270. <!--Steering Control-->
  271. <Grid Grid.Row="2">
  272. </Grid>
  273. </Grid>
  274. <!--Sub Drive Menu-->
  275. <Grid Grid.Column="1" Background="#263238">
  276. <StackPanel>
  277. <Button Margin="7, 20" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2"
  278. Command="{Binding PositionAddCommand}">
  279. <StackPanel>
  280. <!--<materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
  281. <TextBlock Text="Add" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  282. </StackPanel>
  283. </Button>
  284. <Button Margin="7, 20" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2"
  285. Command="{Binding PositionDeleteCommand}">
  286. <StackPanel>
  287. <!--<materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
  288. <TextBlock Text="Delete" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  289. </StackPanel>
  290. </Button>
  291. <Button Margin="7, 20" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2"
  292. Command="{Binding PositionSaveCommand}">
  293. <StackPanel>
  294. <!--<materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
  295. <TextBlock Text="Save" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  296. </StackPanel>
  297. </Button>
  298. <!--Move TO / Current To Target-->
  299. <Button Margin="7, 50" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2"
  300. Command="{Binding MoveToCommand}">
  301. <StackPanel>
  302. <!--<materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
  303. <TextBlock Text="Move To" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  304. </StackPanel>
  305. </Button>
  306. <Button Margin="7,0" HorizontalAlignment="Stretch" Height="60" BorderBrush="Gray" BorderThickness="2"
  307. Command="{Binding CurrentToTargetCommand}">
  308. <StackPanel>
  309. <!--<materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>-->
  310. <TextBlock Text="Current To" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  311. <TextBlock Text="Target" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  312. </StackPanel>
  313. </Button>
  314. </StackPanel>
  315. </Grid>
  316. <!--Right Drive Menu-->
  317. <Grid Grid.Column="2" Background="#263238">
  318. <Border Margin="1" BorderBrush="#FF00FFD3" BorderThickness="2" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
  319. <StackPanel>
  320. <Button Margin="5" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" Command="{Binding ServoOnCommand}">
  321. <StackPanel>
  322. <materialDesign:PackIcon Kind="PowerSettings" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
  323. <TextBlock Text="Servo On" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  324. </StackPanel>
  325. </Button>
  326. <Button Margin="5" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" Command="{Binding ServoOffCommand}">
  327. <StackPanel>
  328. <materialDesign:PackIcon Kind="PowerPlugOff" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
  329. <TextBlock Text="Servo Off" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  330. </StackPanel>
  331. </Button>
  332. <Button Margin="5" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" Command="{Binding FaultResetCommand}">
  333. <StackPanel>
  334. <materialDesign:PackIcon Kind="CircleArrows" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
  335. <TextBlock Text="Fault Reset" VerticalAlignment="Stretch" HorizontalAlignment="Center"/>
  336. </StackPanel>
  337. </Button>
  338. <Button Margin="5" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" Command="{Binding OriginCommand}">
  339. <StackPanel>
  340. <materialDesign:PackIcon Kind="Origin" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
  341. <TextBlock Text="Origin" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
  342. </StackPanel>
  343. </Button>
  344. <Button Margin="5" HorizontalAlignment="Stretch" Height="Auto" BorderBrush="Gray" BorderThickness="2" Command="{Binding CloseDialogCommand}" CommandParameter="true">
  345. <StackPanel>
  346. <materialDesign:PackIcon Kind="ExitToApp" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Height="42" Width="auto"/>
  347. <TextBlock Text="Close" VerticalAlignment="Stretch" HorizontalAlignment="Center" />
  348. </StackPanel>
  349. </Button>
  350. </StackPanel>
  351. </Grid>
  352. </Grid>
  353. </UserControl>