RobotManual.xaml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. <UserControl x:Class="TeamAAS_VP.Controls.RobotManual"
  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:TeamAAS_VP.Controls"
  7. xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
  8. xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
  9. xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
  10. xmlns:sys="clr-namespace:System;assembly=mscorlib"
  11. xmlns:uControl="clr-namespace:TeamAAS_VP.Controls"
  12. xmlns:convert="clr-namespace:TeamAAS_VP.ValueConverter"
  13. xmlns:lex="http://wpflocalizeextension.codeplex.com"
  14. lex:LocalizeDictionary.DesignCulture="zh-CN"
  15. lex:ResxLocalizationProvider.DefaultAssembly="TeamAAS-VP"
  16. lex:ResxLocalizationProvider.DefaultDictionary="Lang"
  17. mc:Ignorable="d"
  18. d:Background="White"
  19. FontFamily="{DynamicResource DefaultFont}">
  20. <UserControl.Resources>
  21. <convert:JogConverter x:Key="JogConverter" />
  22. </UserControl.Resources>
  23. <Grid VerticalAlignment="Center">
  24. <Grid VerticalAlignment="Center">
  25. <Grid.ColumnDefinitions>
  26. <ColumnDefinition Width="auto" />
  27. <ColumnDefinition Width="*" />
  28. </Grid.ColumnDefinitions>
  29. <Grid Grid.Column="0">
  30. <Grid.RowDefinitions>
  31. <RowDefinition Height="auto" />
  32. <RowDefinition Height="auto" />
  33. <RowDefinition Height="auto" />
  34. <RowDefinition Height="auto" />
  35. <RowDefinition Height="auto" />
  36. <RowDefinition Height="auto" />
  37. <RowDefinition Height="auto" />
  38. </Grid.RowDefinitions>
  39. <Button Content="{lex:Loc 连接}"
  40. Grid.Row="0"
  41. materialDesign:ButtonAssist.CornerRadius="10"
  42. Style="{StaticResource MaterialDesignRaisedDarkButton}"
  43. Command="{Binding ConnectCommand}" />
  44. <Button Content="{lex:Loc 断开连接}"
  45. Grid.Row="1"
  46. Margin="0,10,0,10"
  47. materialDesign:ButtonAssist.CornerRadius="10"
  48. Style="{StaticResource MaterialDesignRaisedDarkButton}"
  49. Command="{Binding DisConnectCommand}" />
  50. <Button Content="{lex:Loc 上使能}"
  51. Grid.Row="2"
  52. materialDesign:ButtonAssist.CornerRadius="10"
  53. Style="{StaticResource MaterialDesignRaisedDarkButton}"
  54. Command="{Binding MotorCommand}"
  55. CommandParameter="True" />
  56. <Button Content="{lex:Loc 下使能}"
  57. Grid.Row="3"
  58. Margin="0,10,0,10"
  59. materialDesign:ButtonAssist.CornerRadius="10"
  60. Style="{StaticResource MaterialDesignRaisedDarkButton}"
  61. Command="{Binding MotorCommand}"
  62. CommandParameter="False" />
  63. <Button Content="{lex:Loc 复位错误}"
  64. Grid.Row="4"
  65. materialDesign:ButtonAssist.CornerRadius="10"
  66. Style="{StaticResource MaterialDesignRaisedDarkButton}"
  67. Command="{Binding ResetCommand}" />
  68. <Button Content="{lex:Loc 释放刹车}"
  69. Grid.Row="5"
  70. Margin="0,10,0,10"
  71. materialDesign:ButtonAssist.CornerRadius="10"
  72. Style="{StaticResource MaterialDesignRaisedDarkButton}"
  73. Command="{Binding sFreeCommand}" />
  74. <Button Content="{lex:Loc 锁定刹车}"
  75. Grid.Row="6"
  76. materialDesign:ButtonAssist.CornerRadius="10"
  77. Style="{StaticResource MaterialDesignRaisedDarkButton}"
  78. Command="{Binding SLockCommand}" />
  79. </Grid>
  80. <Grid Grid.Column="1"
  81. Margin="20">
  82. <Grid.ColumnDefinitions>
  83. <ColumnDefinition Width="auto" />
  84. <ColumnDefinition Width="auto" />
  85. <ColumnDefinition Width="auto" />
  86. <ColumnDefinition Width="auto" />
  87. </Grid.ColumnDefinitions>
  88. <Grid.RowDefinitions>
  89. <RowDefinition Height="auto" />
  90. <RowDefinition Height="auto" />
  91. <RowDefinition Height="auto" />
  92. <RowDefinition Height="auto" />
  93. <RowDefinition Height="auto" />
  94. <RowDefinition Height="auto" />
  95. <RowDefinition Height="auto" />
  96. </Grid.RowDefinitions>
  97. <Grid.Resources>
  98. <Style TargetType="Button"
  99. BasedOn="{StaticResource MaterialDesignRaisedDarkButton}">
  100. <Setter Property="Width"
  101. Value="60" />
  102. <Setter Property="Height"
  103. Value="60" />
  104. <Setter Property="FontSize"
  105. Value="13" />
  106. <Setter Property="Padding"
  107. Value="0" />
  108. <Setter Property="HorizontalAlignment"
  109. Value="Center" />
  110. <Setter Property="VerticalAlignment"
  111. Value="Center" />
  112. <Setter Property="Margin"
  113. Value="2" />
  114. <Setter Property="materialDesign:ButtonAssist.CornerRadius"
  115. Value="10" />
  116. </Style>
  117. </Grid.Resources>
  118. <ComboBox Grid.ColumnSpan="3"
  119. Grid.Row="0"
  120. Margin="10,5"
  121. HorizontalAlignment="Left"
  122. materialDesign:HintAssist.Hint="{lex:Loc 选择Tool}"
  123. materialDesign:HintAssist.HelperText="{lex:Loc 选择Tool}"
  124. SelectedItem="{Binding SelectTool,Mode=TwoWay}"
  125. ItemsSource="{Binding Tools}" />
  126. <Button Grid.Row="2"
  127. Grid.Column="0"
  128. Command="{Binding JogCommand}"
  129. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=X-}">
  130. <StackPanel Orientation="Vertical">
  131. <materialDesign:PackIcon Kind="ArrowLeftBold"
  132. Width="26"
  133. Height="26" />
  134. <TextBlock Text="-X"
  135. HorizontalAlignment="Center" />
  136. </StackPanel>
  137. </Button>
  138. <Button Grid.Row="2"
  139. Grid.Column="2"
  140. Command="{Binding JogCommand}"
  141. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=X+}">
  142. <StackPanel Orientation="Vertical">
  143. <materialDesign:PackIcon Kind="ArrowRightBold"
  144. Width="26"
  145. Height="26" />
  146. <TextBlock Text="+X"
  147. HorizontalAlignment="Center" />
  148. </StackPanel>
  149. </Button>
  150. <Button Grid.Row="1"
  151. Grid.Column="1"
  152. Command="{Binding JogCommand}"
  153. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=Y+}">
  154. <StackPanel Orientation="Vertical">
  155. <materialDesign:PackIcon Kind="ArrowTopBold"
  156. Width="26"
  157. Height="26" />
  158. <TextBlock Text="+Y"
  159. HorizontalAlignment="Center" />
  160. </StackPanel>
  161. </Button>
  162. <Button Grid.Row="3"
  163. Grid.Column="1"
  164. Command="{Binding JogCommand}"
  165. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=Y-}">
  166. <StackPanel Orientation="Vertical">
  167. <materialDesign:PackIcon Kind="ArrowBottomBold"
  168. Width="26"
  169. Height="26" />
  170. <TextBlock Text="-Y"
  171. HorizontalAlignment="Center" />
  172. </StackPanel>
  173. </Button>
  174. <Button Grid.Row="1"
  175. Grid.Column="3"
  176. Command="{Binding JogCommand}"
  177. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=Z+}">
  178. <StackPanel Orientation="Vertical">
  179. <materialDesign:PackIcon Kind="ArrowTopBold"
  180. Width="26"
  181. Height="26" />
  182. <TextBlock Text="+Z"
  183. HorizontalAlignment="Center" />
  184. </StackPanel>
  185. </Button>
  186. <Button Grid.Row="3"
  187. Grid.Column="3"
  188. Command="{Binding JogCommand}"
  189. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=Z-}">
  190. <StackPanel Orientation="Vertical">
  191. <materialDesign:PackIcon Kind="ArrowBottomBold"
  192. Width="26"
  193. Height="26" />
  194. <TextBlock Text="-Z"
  195. HorizontalAlignment="Center" />
  196. </StackPanel>
  197. </Button>
  198. <Button Grid.Row="4"
  199. Grid.Column="0"
  200. Command="{Binding JogCommand}"
  201. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=U+}">
  202. <StackPanel Orientation="Vertical">
  203. <materialDesign:PackIcon Kind="AxisZRotateCounterclockwise"
  204. Width="26"
  205. Height="26" />
  206. <TextBlock Text="+U"
  207. HorizontalAlignment="Center" />
  208. </StackPanel>
  209. </Button>
  210. <Button Grid.Row="5"
  211. Grid.Column="0"
  212. Command="{Binding JogCommand}"
  213. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=U-}">
  214. <StackPanel Orientation="Vertical">
  215. <materialDesign:PackIcon Kind="AxisZRotateClockwise"
  216. Width="26"
  217. Height="26" />
  218. <TextBlock Text="-U"
  219. HorizontalAlignment="Center" />
  220. </StackPanel>
  221. </Button>
  222. <Button Grid.Row="4"
  223. Grid.Column="1"
  224. Grid.ColumnSpan="2"
  225. Command="{Binding JogCommand}"
  226. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=V+}">
  227. <StackPanel Orientation="Vertical">
  228. <materialDesign:PackIcon Kind="AxisYRotateCounterclockwise"
  229. Width="26"
  230. Height="26" />
  231. <TextBlock Text="+V"
  232. HorizontalAlignment="Center" />
  233. </StackPanel>
  234. </Button>
  235. <Button Grid.Row="5"
  236. Grid.Column="1"
  237. Grid.ColumnSpan="2"
  238. Command="{Binding JogCommand}"
  239. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=V-}">
  240. <StackPanel Orientation="Vertical">
  241. <materialDesign:PackIcon Kind="AxisYRotateClockwise"
  242. Width="26"
  243. Height="26" />
  244. <TextBlock Text="-V"
  245. HorizontalAlignment="Center" />
  246. </StackPanel>
  247. </Button>
  248. <Button Grid.Row="4"
  249. Grid.Column="3"
  250. Command="{Binding JogCommand}"
  251. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=W+}">
  252. <StackPanel Orientation="Vertical">
  253. <materialDesign:PackIcon Kind="AxisXRotateCounterclockwise"
  254. Width="26"
  255. Height="26" />
  256. <TextBlock Text="+W"
  257. HorizontalAlignment="Center" />
  258. </StackPanel>
  259. </Button>
  260. <Button Grid.Row="5"
  261. Grid.Column="3"
  262. Command="{Binding JogCommand}"
  263. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=W-}">
  264. <StackPanel Orientation="Vertical">
  265. <materialDesign:PackIcon Kind="AxisXRotateClockwise"
  266. Width="26"
  267. Height="26" />
  268. <TextBlock Text="-W"
  269. HorizontalAlignment="Center" />
  270. </StackPanel>
  271. </Button>
  272. <StackPanel Grid.Row="6"
  273. Grid.ColumnSpan="7"
  274. Margin="10,10,0,10"
  275. Grid.Column="0"
  276. VerticalAlignment="Center"
  277. Orientation="Horizontal">
  278. <TextBlock Text="{lex:Loc 步进距离}"
  279. VerticalAlignment="Center" />
  280. <uControl:myNumericUpDowm x:Name="txtDistance"
  281. MinWidth="100"
  282. Interval="0.1"
  283. Minimum="0"
  284. Maximum="100"
  285. StringFormat="{}{0:N3} mm"
  286. Value="{Binding Distance,Mode=TwoWay}"
  287. Margin="10,0" />
  288. </StackPanel>
  289. </Grid>
  290. </Grid>
  291. <materialDesign:Snackbar x:Name="snackbar"
  292. Opacity="0.9"
  293. HorizontalContentAlignment="Center"
  294. VerticalAlignment="Bottom" />
  295. </Grid>
  296. </UserControl>