RobotManual.xaml 17 KB

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