RobotManual.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  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. <StackPanel Grid.ColumnSpan="4"
  119. Grid.Row="0"
  120. Grid.Column="0"
  121. VerticalAlignment="Center"
  122. Orientation="Horizontal">
  123. <ComboBox Grid.ColumnSpan="3"
  124. Grid.Row="0"
  125. Margin="10,5"
  126. HorizontalAlignment="Left"
  127. materialDesign:HintAssist.Hint="{lex:Loc 选择Tool}"
  128. SelectedItem="{Binding SelectTool,Mode=TwoWay}"
  129. ItemsSource="{Binding Tools}" />
  130. <TextBlock VerticalAlignment="Center"
  131. Width="380"
  132. Margin="10,0">
  133. <TextBlock.Text>
  134. <MultiBinding StringFormat="{}CurPos X: {0:F3} mm Y: {1:F3} mm Z: {2:F3} mm U: {3:F3} °">
  135. <Binding Path="Robot.CurrentPosition.X" />
  136. <Binding Path="Robot.CurrentPosition.Y" />
  137. <Binding Path="Robot.CurrentPosition.Z" />
  138. <Binding Path="Robot.CurrentPosition.U" />
  139. </MultiBinding>
  140. </TextBlock.Text>
  141. </TextBlock>
  142. </StackPanel>
  143. <Button Grid.Row="2"
  144. Grid.Column="0"
  145. Command="{Binding JogCommand}"
  146. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=X-}">
  147. <StackPanel Orientation="Vertical">
  148. <materialDesign:PackIcon Kind="ArrowLeftBold"
  149. Width="26"
  150. Height="26" />
  151. <TextBlock Text="-X"
  152. HorizontalAlignment="Center" />
  153. </StackPanel>
  154. </Button>
  155. <Button Grid.Row="2"
  156. Grid.Column="2"
  157. Command="{Binding JogCommand}"
  158. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=X+}">
  159. <StackPanel Orientation="Vertical">
  160. <materialDesign:PackIcon Kind="ArrowRightBold"
  161. Width="26"
  162. Height="26" />
  163. <TextBlock Text="+X"
  164. HorizontalAlignment="Center" />
  165. </StackPanel>
  166. </Button>
  167. <Button Grid.Row="1"
  168. Grid.Column="1"
  169. Command="{Binding JogCommand}"
  170. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=Y+}">
  171. <StackPanel Orientation="Vertical">
  172. <materialDesign:PackIcon Kind="ArrowTopBold"
  173. Width="26"
  174. Height="26" />
  175. <TextBlock Text="+Y"
  176. HorizontalAlignment="Center" />
  177. </StackPanel>
  178. </Button>
  179. <Button Grid.Row="3"
  180. Grid.Column="1"
  181. Command="{Binding JogCommand}"
  182. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=Y-}">
  183. <StackPanel Orientation="Vertical">
  184. <materialDesign:PackIcon Kind="ArrowBottomBold"
  185. Width="26"
  186. Height="26" />
  187. <TextBlock Text="-Y"
  188. HorizontalAlignment="Center" />
  189. </StackPanel>
  190. </Button>
  191. <Button Grid.Row="1"
  192. Grid.Column="3"
  193. Command="{Binding JogCommand}"
  194. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=Z+}">
  195. <StackPanel Orientation="Vertical">
  196. <materialDesign:PackIcon Kind="ArrowTopBold"
  197. Width="26"
  198. Height="26" />
  199. <TextBlock Text="+Z"
  200. HorizontalAlignment="Center" />
  201. </StackPanel>
  202. </Button>
  203. <Button Grid.Row="3"
  204. Grid.Column="3"
  205. Command="{Binding JogCommand}"
  206. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=Z-}">
  207. <StackPanel Orientation="Vertical">
  208. <materialDesign:PackIcon Kind="ArrowBottomBold"
  209. Width="26"
  210. Height="26" />
  211. <TextBlock Text="-Z"
  212. HorizontalAlignment="Center" />
  213. </StackPanel>
  214. </Button>
  215. <Button Grid.Row="4"
  216. Grid.Column="0"
  217. Command="{Binding JogCommand}"
  218. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=U+}">
  219. <StackPanel Orientation="Vertical">
  220. <materialDesign:PackIcon Kind="AxisZRotateCounterclockwise"
  221. Width="26"
  222. Height="26" />
  223. <TextBlock Text="+U"
  224. HorizontalAlignment="Center" />
  225. </StackPanel>
  226. </Button>
  227. <Button Grid.Row="5"
  228. Grid.Column="0"
  229. Command="{Binding JogCommand}"
  230. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=U-}">
  231. <StackPanel Orientation="Vertical">
  232. <materialDesign:PackIcon Kind="AxisZRotateClockwise"
  233. Width="26"
  234. Height="26" />
  235. <TextBlock Text="-U"
  236. HorizontalAlignment="Center" />
  237. </StackPanel>
  238. </Button>
  239. <Button Grid.Row="4"
  240. Grid.Column="1"
  241. Grid.ColumnSpan="2"
  242. Command="{Binding JogCommand}"
  243. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=V+}">
  244. <StackPanel Orientation="Vertical">
  245. <materialDesign:PackIcon Kind="AxisYRotateCounterclockwise"
  246. Width="26"
  247. Height="26" />
  248. <TextBlock Text="+V"
  249. HorizontalAlignment="Center" />
  250. </StackPanel>
  251. </Button>
  252. <Button Grid.Row="5"
  253. Grid.Column="1"
  254. Grid.ColumnSpan="2"
  255. Command="{Binding JogCommand}"
  256. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=V-}">
  257. <StackPanel Orientation="Vertical">
  258. <materialDesign:PackIcon Kind="AxisYRotateClockwise"
  259. Width="26"
  260. Height="26" />
  261. <TextBlock Text="-V"
  262. HorizontalAlignment="Center" />
  263. </StackPanel>
  264. </Button>
  265. <Button Grid.Row="4"
  266. Grid.Column="3"
  267. Command="{Binding JogCommand}"
  268. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=W+}">
  269. <StackPanel Orientation="Vertical">
  270. <materialDesign:PackIcon Kind="AxisXRotateCounterclockwise"
  271. Width="26"
  272. Height="26" />
  273. <TextBlock Text="+W"
  274. HorizontalAlignment="Center" />
  275. </StackPanel>
  276. </Button>
  277. <Button Grid.Row="5"
  278. Grid.Column="3"
  279. Command="{Binding JogCommand}"
  280. CommandParameter="{Binding ElementName=txtDistance,Path=Value,Converter={StaticResource JogConverter}, ConverterParameter=W-}">
  281. <StackPanel Orientation="Vertical">
  282. <materialDesign:PackIcon Kind="AxisXRotateClockwise"
  283. Width="26"
  284. Height="26" />
  285. <TextBlock Text="-W"
  286. HorizontalAlignment="Center" />
  287. </StackPanel>
  288. </Button>
  289. <StackPanel Grid.Row="6"
  290. Grid.ColumnSpan="7"
  291. Margin="10,10,0,10"
  292. Grid.Column="0"
  293. VerticalAlignment="Center"
  294. Orientation="Horizontal">
  295. <TextBlock Text="{lex:Loc 步进距离}"
  296. VerticalAlignment="Center" />
  297. <uControl:myNumericUpDowm x:Name="txtDistance"
  298. MinWidth="100"
  299. Interval="0.1"
  300. Minimum="0"
  301. Maximum="100"
  302. StringFormat="{}{0:N3} mm"
  303. Value="{Binding Distance,Mode=TwoWay}"
  304. Margin="10,0" />
  305. </StackPanel>
  306. </Grid>
  307. </Grid>
  308. <materialDesign:Snackbar x:Name="snackbar"
  309. Opacity="0.9"
  310. HorizontalContentAlignment="Center"
  311. VerticalAlignment="Bottom" />
  312. </Grid>
  313. </UserControl>