FeederClear.xaml 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  1. <UserControl x:Class="TeamAAS_VP.Views.DebugMod.FeederClear"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:prism="http://prismlibrary.com/"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  7. xmlns:vm="clr-namespace:TeamAAS_VP.ViewModels.DebugMod"
  8. xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
  9. xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
  10. xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
  11. xmlns:sys="clr-namespace:System;assembly=mscorlib"
  12. xmlns:enums="clr-namespace:TeamAAS_VP.Enums"
  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. prism:ViewModelLocator.AutoWireViewModel="True"
  18. mc:Ignorable="d"
  19. d:Background="White"
  20. d:DataContext="{d:DesignInstance Type=vm:FeederClearViewModel}"
  21. FontFamily="{DynamicResource DefaultFont}">
  22. <b:Interaction.Triggers>
  23. <b:EventTrigger EventName="Loaded">
  24. <b:InvokeCommandAction Command="{Binding LoadedCommand}" />
  25. </b:EventTrigger>
  26. </b:Interaction.Triggers>
  27. <UserControl.Resources>
  28. <ObjectDataProvider x:Key="eVibrationFunction"
  29. MethodName="GetValues"
  30. ObjectType="{x:Type sys:Enum}">
  31. <ObjectDataProvider.MethodParameters>
  32. <x:Type TypeName="enums:VibrationFunction" />
  33. </ObjectDataProvider.MethodParameters>
  34. </ObjectDataProvider>
  35. </UserControl.Resources>
  36. <Grid IsEnabled="{Binding IsAllowEdit}"
  37. HorizontalAlignment="Center"
  38. VerticalAlignment="Top">
  39. <Grid.RowDefinitions>
  40. <RowDefinition Height="auto" />
  41. <RowDefinition Height="auto" />
  42. <RowDefinition Height="*" />
  43. </Grid.RowDefinitions>
  44. <Border Grid.Row="2"
  45. CornerRadius="10"
  46. BorderThickness="1"
  47. BorderBrush="Gray"
  48. HorizontalAlignment="Center"
  49. IsEnabled="{Binding IsCanEdit}"
  50. Margin="0,10">
  51. <ScrollViewer Margin="20">
  52. <StackPanel Orientation="Vertical">
  53. <!-- 任务管理:全局任务列表与批量操作 -->
  54. <Border BorderBrush="LightGray"
  55. BorderThickness="1"
  56. CornerRadius="6"
  57. Padding="8"
  58. Margin="0,0,0,10">
  59. <StackPanel Orientation="Vertical">
  60. <StackPanel Orientation="Horizontal"
  61. VerticalAlignment="Center">
  62. <TextBlock Text="{lex:Loc 任务管理}"
  63. FontWeight="Bold"
  64. FontSize="14" />
  65. <StackPanel Orientation="Horizontal"
  66. HorizontalAlignment="Right"
  67. Margin="10,0,0,0">
  68. <!-- 新建/移除/保存/分配/启动 等操作 -->
  69. <Button Margin="5,0"
  70. Command="{Binding AddClearTaskCommand}">
  71. <StackPanel Orientation="Horizontal">
  72. <materialDesign:PackIcon Kind="Add" />
  73. <TextBlock Text="{lex:Loc 新建任务}" />
  74. </StackPanel>
  75. </Button>
  76. <Button Margin="5,0"
  77. Command="{Binding RemoveClearTaskCommand}">
  78. <StackPanel Orientation="Horizontal">
  79. <materialDesign:PackIcon Kind="Remove" />
  80. <TextBlock Text="{lex:Loc 移除任务}" />
  81. </StackPanel>
  82. </Button>
  83. <Button Margin="5,0"
  84. Command="{Binding SaveClearTaskCommand}">
  85. <StackPanel Orientation="Horizontal">
  86. <materialDesign:PackIcon Kind="ContentSave" />
  87. <TextBlock Margin=" 5,0"
  88. Text="{lex:Loc 保存任务}" />
  89. </StackPanel>
  90. </Button>
  91. <Button HorizontalAlignment="Center"
  92. materialDesign:ButtonAssist.CornerRadius="10"
  93. MinWidth="150"
  94. Command="{Binding StartSelectedCommand}"
  95. Margin="5,0">
  96. <StackPanel Orientation="Horizontal">
  97. <materialDesign:PackIcon Kind="Play" />
  98. <TextBlock Margin=" 5,0"
  99. Text="{lex:Loc 开始清料}" />
  100. </StackPanel>
  101. </Button>
  102. </StackPanel>
  103. </StackPanel>
  104. <Grid Margin="0,8,0,0">
  105. <Grid.ColumnDefinitions>
  106. <ColumnDefinition Width="3*" />
  107. <ColumnDefinition Width="2*" />
  108. </Grid.ColumnDefinitions>
  109. <!-- 全局任务列表 -->
  110. <ListView ItemsSource="{Binding AllTasks}"
  111. Height="180"
  112. SelectedItem="{Binding SelelctFeederClearWork, Mode=TwoWay}">
  113. <ListView.ItemTemplate>
  114. <DataTemplate>
  115. <StackPanel Orientation="Horizontal">
  116. <TextBlock Text="{Binding TaskCode}"
  117. Margin="0,0,8,0" />
  118. <TextBlock Text="{Binding Name}"
  119. Width="200" />
  120. <TextBlock Text="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd HH:mm}}"
  121. Foreground="Gray"
  122. Width="140" />
  123. <TextBlock Text="Feeder:"
  124. Foreground="Gray"
  125. Margin="6,0,2,0" />
  126. <TextBlock Text="{Binding FeederName}"
  127. Foreground="DarkGray" />
  128. </StackPanel>
  129. </DataTemplate>
  130. </ListView.ItemTemplate>
  131. </ListView>
  132. <!-- 所选任务快速编辑 -->
  133. <StackPanel Grid.Column="1"
  134. Margin="12,0,0,0"
  135. VerticalAlignment="Top">
  136. <TextBlock Text="{lex:Loc 编辑所选任务}"
  137. FontWeight="SemiBold" />
  138. <StackPanel Orientation="Vertical"
  139. Margin="0,6,0,0">
  140. <StackPanel Orientation="Horizontal"
  141. VerticalAlignment="Center">
  142. <TextBlock Text="{lex:Loc 名称, Converter={StaticResource StringFormatConverter},ConverterParameter='{}{0}: '}"
  143. Width="60"
  144. VerticalAlignment="Center" />
  145. <TextBox Text="{Binding SelelctFeederClearWork.Name, Mode=TwoWay}"
  146. MinWidth="160" />
  147. </StackPanel>
  148. <StackPanel Orientation="Horizontal"
  149. Margin="0,6,0,0">
  150. <TextBlock Text="{lex:Loc 描述, Converter={StaticResource StringFormatConverter},ConverterParameter='{}{0}: '}"
  151. Width="60"
  152. VerticalAlignment="Top" />
  153. <TextBox Text="{Binding SelelctFeederClearWork.Description, Mode=TwoWay}"
  154. MinWidth="160"
  155. Height="60"
  156. AcceptsReturn="True"
  157. TextWrapping="Wrap" />
  158. </StackPanel>
  159. <StackPanel Orientation="Horizontal"
  160. Margin="0,6,0,0">
  161. <TextBlock Text="Feeder:"
  162. Width="60"
  163. VerticalAlignment="Center" />
  164. <ComboBox IsEnabled="{Binding IsCanSelect}"
  165. SelectedItem="{Binding SelectFeeder,Mode=TwoWay}"
  166. Margin="5,0"
  167. MinWidth="80"
  168. HorizontalContentAlignment="Center"
  169. ItemsSource="{Binding DataContext.Feeders,RelativeSource={RelativeSource AncestorType=UserControl}}"
  170. HorizontalAlignment="Left"
  171. VerticalAlignment="Center"
  172. materialDesign:HintAssist.Hint="{lex:Loc 选择Feeder}">
  173. <ComboBox.ItemTemplate>
  174. <DataTemplate>
  175. <StackPanel Orientation="Horizontal">
  176. <materialDesign:PackIcon Kind="Vibrate" />
  177. <TextBlock Text="{Binding FeederName}" />
  178. </StackPanel>
  179. </DataTemplate>
  180. </ComboBox.ItemTemplate>
  181. </ComboBox>
  182. </StackPanel>
  183. <StackPanel Orientation="Horizontal"
  184. Margin="0,6,0,0">
  185. <TextBlock Text="{lex:Loc 循环次数, Converter={StaticResource StringFormatConverter},ConverterParameter='{}{0}: '}"
  186. Width="60"
  187. VerticalAlignment="Center" />
  188. <mah:NumericUpDown Value="{Binding SelelctFeederClearWork.ClearCount, Mode=TwoWay}"
  189. Minimum="1"
  190. Maximum="1000"
  191. Width="80" />
  192. </StackPanel>
  193. </StackPanel>
  194. </StackPanel>
  195. </Grid>
  196. </StackPanel>
  197. </Border>
  198. <!--清料前-->
  199. <Expander HorizontalAlignment="Stretch"
  200. Background="Transparent"
  201. IsEnabled="{Binding IsCanExecute}"
  202. materialDesign:ExpanderAssist.ExpanderButtonPosition="Start"
  203. IsExpanded="True">
  204. <Expander.Header>
  205. <TextBlock FontWeight="Bold"
  206. Text="{lex:Loc 清料开始前}" />
  207. </Expander.Header>
  208. <StackPanel Orientation="Vertical"
  209. Margin="10,3">
  210. <StackPanel Orientation="Horizontal">
  211. <TextBlock Text="{lex:Loc 输出,Converter={StaticResource StringFormatConverter},ConverterParameter='{}{0}: '}"
  212. VerticalAlignment="Center" />
  213. <ComboBox MinWidth="100"
  214. materialDesign:HintAssist.Hint="{lex:Loc 选择输出}"
  215. materialDesign:HintAssist.HelperText="{lex:Loc 选择输出}"
  216. Margin="5,0"
  217. SelectedItem="{Binding SelelctFeederClearWork.BeforeOutput,Mode=TwoWay}"
  218. ItemsSource="{Binding Source={StaticResource eVibrationFunction}}" />
  219. <Button Style="{StaticResource MaterialDesignIconButton}">
  220. <materialDesign:PackIcon Kind="ScriptTextPlayOutline" />
  221. </Button>
  222. </StackPanel>
  223. </StackPanel>
  224. </Expander>
  225. <!--振动盘-->
  226. <Border BorderThickness="1,1,1,1"
  227. CornerRadius="10"
  228. Margin="0,2">
  229. <Border.BorderBrush>
  230. <VisualBrush>
  231. <VisualBrush.Visual>
  232. <Rectangle StrokeDashArray="4 4"
  233. Stroke="Gray"
  234. StrokeThickness="1"
  235. Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
  236. Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}" />
  237. </VisualBrush.Visual>
  238. </VisualBrush>
  239. </Border.BorderBrush>
  240. <Expander HorizontalAlignment="Stretch"
  241. Background="Transparent"
  242. IsEnabled="{Binding IsCanExecute}"
  243. materialDesign:ExpanderAssist.ExpanderButtonPosition="Start"
  244. IsExpanded="True">
  245. <Expander.Header>
  246. <TextBlock FontWeight="Bold"
  247. Text="{lex:Loc 清料过程}" />
  248. </Expander.Header>
  249. <StackPanel Orientation="Vertical"
  250. Margin="10,3">
  251. <StackPanel Orientation="Horizontal">
  252. <TextBlock Text="{lex:Loc 动作,Converter={StaticResource StringFormatConverter},ConverterParameter='{}{0}: '}"
  253. VerticalAlignment="Center" />
  254. <ComboBox MinWidth="100"
  255. materialDesign:HintAssist.Hint="{lex:Loc 选择动作}"
  256. materialDesign:HintAssist.HelperText="{lex:Loc 选择动作}"
  257. Margin="5,0"
  258. SelectedIndex="{Binding SelectFeederFunctionIndex,Mode=TwoWay}">
  259. <!--A-->
  260. <ComboBoxItem>
  261. <StackPanel Orientation="Horizontal">
  262. <TextBlock Text="A"
  263. VerticalAlignment="Center" />
  264. <materialDesign:PackIcon Kind="ArrowLeftBold"
  265. Margin="5,0" />
  266. </StackPanel>
  267. </ComboBoxItem>
  268. <!--B-->
  269. <ComboBoxItem>
  270. <StackPanel Orientation="Horizontal">
  271. <TextBlock Text="B"
  272. VerticalAlignment="Center" />
  273. <materialDesign:PackIcon Kind="ArrowBottomLeftThick"
  274. Margin="5,0" />
  275. </StackPanel>
  276. </ComboBoxItem>
  277. <!--C-->
  278. <ComboBoxItem>
  279. <StackPanel Orientation="Horizontal">
  280. <TextBlock Text="C"
  281. VerticalAlignment="Center" />
  282. <materialDesign:PackIcon Kind="ArrowTopLeftThick"
  283. Margin="5,0" />
  284. </StackPanel>
  285. </ComboBoxItem>
  286. <!--D-->
  287. <ComboBoxItem>
  288. <StackPanel Orientation="Horizontal">
  289. <TextBlock Text="D"
  290. VerticalAlignment="Center" />
  291. <materialDesign:PackIcon Kind="ArrowDownBold"
  292. Margin="5,0" />
  293. </StackPanel>
  294. </ComboBoxItem>
  295. <!--E-->
  296. <ComboBoxItem>
  297. <StackPanel Orientation="Horizontal">
  298. <TextBlock Text="E"
  299. VerticalAlignment="Center" />
  300. <materialDesign:PackIcon Kind="ArrowUpBold"
  301. Margin="5,0" />
  302. </StackPanel>
  303. </ComboBoxItem>
  304. <!--F-->
  305. <ComboBoxItem>
  306. <StackPanel Orientation="Horizontal">
  307. <TextBlock Text="F"
  308. VerticalAlignment="Center" />
  309. <materialDesign:PackIcon Kind="ArrowRightBold"
  310. Margin="5,0" />
  311. </StackPanel>
  312. </ComboBoxItem>
  313. <!--G-->
  314. <ComboBoxItem>
  315. <StackPanel Orientation="Horizontal">
  316. <TextBlock Text="G"
  317. VerticalAlignment="Center" />
  318. <materialDesign:PackIcon Kind="ArrowBottomRightThick"
  319. Margin="5,0" />
  320. </StackPanel>
  321. </ComboBoxItem>
  322. <!--H-->
  323. <ComboBoxItem>
  324. <StackPanel Orientation="Horizontal">
  325. <TextBlock Text="H"
  326. VerticalAlignment="Center" />
  327. <materialDesign:PackIcon Kind="ArrowTopRightThick"
  328. Margin="5,0" />
  329. </StackPanel>
  330. </ComboBoxItem>
  331. <!--I-->
  332. <ComboBoxItem>
  333. <StackPanel Orientation="Horizontal">
  334. <TextBlock Text="I"
  335. VerticalAlignment="Center" />
  336. <materialDesign:PackIcon Kind="ArrowExpandAll"
  337. Margin="5,0" />
  338. </StackPanel>
  339. </ComboBoxItem>
  340. <!--J-->
  341. <ComboBoxItem>
  342. <StackPanel Orientation="Horizontal">
  343. <TextBlock Text="J"
  344. VerticalAlignment="Center" />
  345. <materialDesign:PackIcon Kind="ArrowCollapseHorizontal"
  346. Margin="5,0" />
  347. </StackPanel>
  348. </ComboBoxItem>
  349. <!--K-->
  350. <ComboBoxItem>
  351. <StackPanel Orientation="Horizontal">
  352. <TextBlock Text="K"
  353. VerticalAlignment="Center" />
  354. <materialDesign:PackIcon Kind="ArrowCollapseVertical"
  355. Margin="5,0" />
  356. </StackPanel>
  357. </ComboBoxItem>
  358. <!--L-->
  359. <ComboBoxItem>L</ComboBoxItem>
  360. <!--M-->
  361. <ComboBoxItem>M</ComboBoxItem>
  362. <!--N-->
  363. <ComboBoxItem>N</ComboBoxItem>
  364. <!--O-->
  365. <ComboBoxItem>O</ComboBoxItem>
  366. <!--P-->
  367. <ComboBoxItem>P</ComboBoxItem>
  368. <!--Q-->
  369. <ComboBoxItem>Q</ComboBoxItem>
  370. <!--R-->
  371. <ComboBoxItem>R</ComboBoxItem>
  372. <!--S-->
  373. <ComboBoxItem>S</ComboBoxItem>
  374. <!--T-->
  375. <ComboBoxItem>T</ComboBoxItem>
  376. <!--U-->
  377. <ComboBoxItem>U</ComboBoxItem>
  378. <!--V-->
  379. <ComboBoxItem>V</ComboBoxItem>
  380. <!--W-->
  381. <ComboBoxItem>W</ComboBoxItem>
  382. <!--X-->
  383. <ComboBoxItem>X</ComboBoxItem>
  384. <!--Y-->
  385. <ComboBoxItem>Y</ComboBoxItem>
  386. <!--Z-->
  387. <ComboBoxItem>Z</ComboBoxItem>
  388. <!--Delay-->
  389. <ComboBoxItem>Delay</ComboBoxItem>
  390. </ComboBox>
  391. <Button Content="{lex:Loc 添加}"
  392. materialDesign:ButtonAssist.CornerRadius="10"
  393. Command="{Binding AddFunctionCommand}" />
  394. <Button Content="{lex:Loc 移除}"
  395. Margin="5,0"
  396. materialDesign:ButtonAssist.CornerRadius="10"
  397. Command="{Binding RemoveFunctionCommand}"
  398. CommandParameter="{Binding ElementName=lstAction,Path=SelectedIndex}" />
  399. <mah:NumericUpDown Interval="1"
  400. Style="{StaticResource MahApps.Styles.NumericUpDown.DataGrid.Editing}"
  401. Minimum="1"
  402. Maximum="100"
  403. materialDesign:HintAssist.Hint="{lex:Loc 循环次数}"
  404. materialDesign:HintAssist.HelperText="{lex:Loc 循环次数}"
  405. BorderThickness="1"
  406. VerticalAlignment="Center"
  407. StringFormat="{}{0:N0}"
  408. Value="{Binding SelelctFeederClearWork.VibrationCount,Mode=TwoWay}" />
  409. </StackPanel>
  410. <ListView x:Name="lstAction"
  411. ItemsSource="{Binding SelelctFeederClearWork.FeederWorks.FeederWorkList}">
  412. <ListView.View>
  413. <GridView>
  414. <GridViewColumn Header="Setp"
  415. DisplayMemberBinding="{Binding Step}" />
  416. <GridViewColumn Header="{lex:Loc 动作}">
  417. <GridViewColumn.CellTemplate>
  418. <DataTemplate>
  419. <ComboBox Width="100"
  420. HorizontalContentAlignment="Center"
  421. SelectedItem="{Binding Function,Mode=TwoWay}"
  422. ItemsSource="{Binding Source={StaticResource eVibrationFunction}}">
  423. </ComboBox>
  424. </DataTemplate>
  425. </GridViewColumn.CellTemplate>
  426. </GridViewColumn>
  427. <GridViewColumn Header="{lex:Loc 持续时间,Converter={StaticResource StringFormatConverter},ConverterParameter='{}{0}(ms)'}">
  428. <GridViewColumn.CellTemplate>
  429. <DataTemplate>
  430. <mah:NumericUpDown Interval="100"
  431. Style="{StaticResource MahApps.Styles.NumericUpDown.DataGrid.Editing}"
  432. Minimum="1"
  433. Maximum="100000"
  434. StringFormat="{}{0:N0} ms"
  435. Value="{Binding Duration,Mode=TwoWay}" />
  436. </DataTemplate>
  437. </GridViewColumn.CellTemplate>
  438. </GridViewColumn>
  439. </GridView>
  440. </ListView.View>
  441. </ListView>
  442. </StackPanel>
  443. </Expander>
  444. </Border>
  445. <!--清料完成时-->
  446. <Expander HorizontalAlignment="Stretch"
  447. Background="Transparent"
  448. IsEnabled="{Binding IsCanExecute}"
  449. materialDesign:ExpanderAssist.ExpanderButtonPosition="Start"
  450. IsExpanded="True">
  451. <Expander.Header>
  452. <TextBlock FontWeight="Bold"
  453. Text="{lex:Loc 清料完成时}" />
  454. </Expander.Header>
  455. <StackPanel Orientation="Vertical"
  456. Margin="10,3">
  457. <StackPanel Orientation="Horizontal">
  458. <TextBlock Text="{lex:Loc 输出,Converter={StaticResource StringFormatConverter},ConverterParameter='{}{0}: '}"
  459. VerticalAlignment="Center" />
  460. <ComboBox MinWidth="100"
  461. materialDesign:HintAssist.Hint="{lex:Loc 选择输出}"
  462. materialDesign:HintAssist.HelperText="{lex:Loc 选择输出}"
  463. Margin="5,0"
  464. SelectedItem="{Binding SelelctFeederClearWork.BackOutput,Mode=TwoWay}"
  465. ItemsSource="{Binding Source={StaticResource eVibrationFunction}}" />
  466. <Button Style="{StaticResource MaterialDesignIconButton}">
  467. <materialDesign:PackIcon Kind="ScriptTextPlayOutline" />
  468. </Button>
  469. </StackPanel>
  470. </StackPanel>
  471. </Expander>
  472. </StackPanel>
  473. </ScrollViewer>
  474. </Border>
  475. </Grid>
  476. </UserControl>