终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

490 lines
29 KiB

  1. <Window
  2. x:Class="FryPot_DosingSystem.View.NewRecipeView"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:Themes1="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"
  6. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7. xmlns:local="clr-namespace:FryPot_DosingSystem.View"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. xmlns:vm="clr-namespace:FryPot_DosingSystem.ViewModel"
  10. Title="NewRecipeView"
  11. Width="800"
  12. Height="550"
  13. AllowsTransparency="True"
  14. WindowStartupLocation="CenterScreen"
  15. WindowStyle="None"
  16. mc:Ignorable="d">
  17. <Window.DataContext>
  18. <vm:NewRecipeViewModel />
  19. </Window.DataContext>
  20. <Window.Resources>
  21. <ResourceDictionary>
  22. <ResourceDictionary.MergedDictionaries>
  23. <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml" />
  24. <ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml" />
  25. <ResourceDictionary>
  26. <!--#region ListBox样式-->
  27. <Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
  28. <Setter Property="OverridesDefaultStyle" Value="True" />
  29. <Setter Property="SnapsToDevicePixels" Value="True" />
  30. <Setter Property="BorderBrush" Value="{x:Null}" />
  31. <Setter Property="Foreground" Value="White" />
  32. <Setter Property="FontSize" Value="20" />
  33. <Setter Property="HorizontalContentAlignment" Value="Center" />
  34. <Setter Property="VerticalContentAlignment" Value="Center" />
  35. <Setter Property="Template">
  36. <Setter.Value>
  37. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  38. <Border x:Name="border" CornerRadius="8">
  39. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
  40. </Border>
  41. </ControlTemplate>
  42. </Setter.Value>
  43. </Setter>
  44. </Style>
  45. <!--#endregion-->
  46. </ResourceDictionary>
  47. </ResourceDictionary.MergedDictionaries>
  48. <SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3" />
  49. <SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA" />
  50. <SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5" />
  51. <Style x:Key="TextBoxStyle" TargetType="{x:Type TextBox}">
  52. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
  53. <Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}" />
  54. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
  55. <Setter Property="BorderThickness" Value="1" />
  56. <Setter Property="KeyboardNavigation.TabNavigation" Value="None" />
  57. <Setter Property="HorizontalContentAlignment" Value="Left" />
  58. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  59. <Setter Property="AllowDrop" Value="true" />
  60. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
  61. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  62. <Setter Property="Template">
  63. <Setter.Value>
  64. <ControlTemplate TargetType="{x:Type TextBox}">
  65. <Border
  66. x:Name="border"
  67. Background="{TemplateBinding Background}"
  68. BorderBrush="{TemplateBinding BorderBrush}"
  69. BorderThickness="{TemplateBinding BorderThickness}"
  70. SnapsToDevicePixels="True">
  71. <ScrollViewer
  72. x:Name="PART_ContentHost"
  73. Focusable="false"
  74. HorizontalScrollBarVisibility="Hidden"
  75. VerticalScrollBarVisibility="Hidden" />
  76. </Border>
  77. <ControlTemplate.Triggers>
  78. <Trigger Property="IsEnabled" Value="false">
  79. <Setter TargetName="border" Property="Opacity" Value="0.56" />
  80. </Trigger>
  81. <Trigger Property="IsMouseOver" Value="true">
  82. <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource TextBox.MouseOver.Border}" />
  83. </Trigger>
  84. <Trigger Property="IsKeyboardFocused" Value="true">
  85. <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource TextBox.Focus.Border}" />
  86. </Trigger>
  87. </ControlTemplate.Triggers>
  88. </ControlTemplate>
  89. </Setter.Value>
  90. </Setter>
  91. <Style.Triggers>
  92. <MultiTrigger>
  93. <MultiTrigger.Conditions>
  94. <Condition Property="IsInactiveSelectionHighlightEnabled" Value="true" />
  95. <Condition Property="IsSelectionActive" Value="false" />
  96. </MultiTrigger.Conditions>
  97. <Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}" />
  98. </MultiTrigger>
  99. </Style.Triggers>
  100. </Style>
  101. <SolidColorBrush x:Key="foreground" Color="#a2c2e8" />
  102. <SolidColorBrush x:Key="borderBrush" Color="Aqua" />
  103. <Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}">
  104. <Setter Property="FocusVisualStyle" Value="{StaticResource ComboBoxFocusVisual}" />
  105. <Setter Property="Foreground" Value="{DynamicResource foreground}" />
  106. <Setter Property="Background" Value="Transparent" />
  107. <Setter Property="BorderBrush" Value="{DynamicResource borderBrush}" />
  108. <Setter Property="BorderThickness" Value="1" />
  109. <Setter Property="Margin" Value="0,0,0,0" />
  110. <Setter Property="Padding" Value="0" />
  111. <Setter Property="Height" Value="24" />
  112. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
  113. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
  114. <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
  115. <Setter Property="ScrollViewer.PanningMode" Value="Both" />
  116. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  117. <Setter Property="VerticalContentAlignment" Value="Center" />
  118. <Setter Property="IsTextSearchCaseSensitive" Value="true" />
  119. <Setter Property="IsEditable" Value="true" />
  120. <Setter Property="StaysOpenOnEdit" Value="true" />
  121. <Setter Property="Template">
  122. <Setter.Value>
  123. <ControlTemplate TargetType="{x:Type ComboBox}">
  124. <Border
  125. Background="{TemplateBinding Background}"
  126. BorderBrush="{TemplateBinding BorderBrush}"
  127. BorderThickness="{TemplateBinding BorderThickness}"
  128. SnapsToDevicePixels="true">
  129. <Grid>
  130. <Themes1:ClassicBorderDecorator
  131. x:Name="Border"
  132. BorderBrush="{x:Static Themes1:ClassicBorderDecorator.ClassicBorderBrush}"
  133. BorderStyle="None"
  134. BorderThickness="2">
  135. <Popup
  136. x:Name="PART_Popup"
  137. AllowsTransparency="true"
  138. Focusable="False"
  139. IsOpen="{TemplateBinding IsDropDownOpen}"
  140. Placement="Bottom"
  141. PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  142. <Themes1:SystemDropShadowChrome
  143. x:Name="Shdw"
  144. MinWidth="{Binding ActualWidth, ElementName=Border}"
  145. MaxHeight="{TemplateBinding MaxDropDownHeight}"
  146. Color="Transparent">
  147. <Border
  148. x:Name="DropDownBorder"
  149. BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
  150. BorderThickness="1">
  151. <Border.Background>
  152. <SolidColorBrush Color="#264c73" />
  153. </Border.Background>
  154. <ScrollViewer x:Name="DropDownScrollViewer">
  155. <Grid RenderOptions.ClearTypeHint="Enabled">
  156. <Canvas
  157. Width="0"
  158. Height="0"
  159. HorizontalAlignment="Left"
  160. VerticalAlignment="Top">
  161. <Rectangle
  162. x:Name="OpaqueRect"
  163. Width="{Binding ActualWidth, ElementName=DropDownBorder}"
  164. Height="{Binding ActualHeight, ElementName=DropDownBorder}"
  165. Fill="{Binding Background, ElementName=DropDownBorder}" />
  166. </Canvas>
  167. <ItemsPresenter
  168. x:Name="ItemsPresenter"
  169. KeyboardNavigation.DirectionalNavigation="Contained"
  170. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  171. </Grid>
  172. </ScrollViewer>
  173. </Border>
  174. </Themes1:SystemDropShadowChrome>
  175. </Popup>
  176. </Themes1:ClassicBorderDecorator>
  177. <DockPanel Margin="2">
  178. <FrameworkElement Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" DockPanel.Dock="Right" />
  179. <Border x:Name="SelectedItemBorder" Margin="{TemplateBinding Padding}">
  180. <ContentPresenter
  181. Margin="1,1,1,1"
  182. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  183. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  184. Content="{TemplateBinding SelectionBoxItem}"
  185. ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
  186. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  187. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
  188. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  189. </Border>
  190. </DockPanel>
  191. <ToggleButton
  192. Width="Auto"
  193. MinWidth="0"
  194. MinHeight="0"
  195. Margin="2"
  196. ClickMode="Press"
  197. Focusable="false"
  198. IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  199. Style="{StaticResource ComboBoxTransparentButtonStyle}" />
  200. </Grid>
  201. </Border>
  202. <ControlTemplate.Triggers>
  203. <MultiTrigger>
  204. <MultiTrigger.Conditions>
  205. <Condition Property="IsDropDownOpen" Value="false" />
  206. </MultiTrigger.Conditions>
  207. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}" />
  208. </MultiTrigger>
  209. <Trigger Property="HasItems" Value="false">
  210. <Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" />
  211. </Trigger>
  212. <Trigger Property="IsEnabled" Value="false">
  213. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  214. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
  215. </Trigger>
  216. <MultiTrigger>
  217. <MultiTrigger.Conditions>
  218. <Condition Property="IsGrouping" Value="true" />
  219. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
  220. </MultiTrigger.Conditions>
  221. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  222. </MultiTrigger>
  223. <Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true">
  224. <Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" />
  225. <Setter TargetName="Shdw" Property="Color" Value="#71000000" />
  226. </Trigger>
  227. <Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
  228. <Setter TargetName="OpaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" />
  229. <Setter TargetName="OpaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" />
  230. </Trigger>
  231. </ControlTemplate.Triggers>
  232. </ControlTemplate>
  233. </Setter.Value>
  234. </Setter>
  235. <Style.Triggers>
  236. <Trigger Property="IsEditable" Value="true">
  237. <Setter Property="IsTabStop" Value="false" />
  238. <Setter Property="Padding" Value="1" />
  239. <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" />
  240. </Trigger>
  241. </Style.Triggers>
  242. </Style>
  243. </ResourceDictionary>
  244. </Window.Resources>
  245. <Border Name="br">
  246. <Border.Background>
  247. <!--<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/bg.png"></ImageBrush>-->
  248. <SolidColorBrush Color="#264c73" />
  249. </Border.Background>
  250. <Grid>
  251. <Grid.RowDefinitions>
  252. <RowDefinition Height="50" />
  253. <RowDefinition Height="80" />
  254. <RowDefinition Height="40" />
  255. <RowDefinition />
  256. </Grid.RowDefinitions>
  257. <TextBlock
  258. Margin="0,10"
  259. HorizontalAlignment="Center"
  260. VerticalAlignment="Center"
  261. FontSize="25"
  262. Foreground="#FF2AB2E7"
  263. Text="配方信息" />
  264. <UniformGrid Grid.Row="1" Columns="2">
  265. <StackPanel Orientation="Vertical">
  266. <StackPanel Margin="0,8" Orientation="Horizontal">
  267. <TextBlock
  268. Margin="10,0,5,0"
  269. VerticalAlignment="Center"
  270. FontSize="18"
  271. Foreground="#FF2AB2E7"
  272. Text="请输入配方名称:" />
  273. <TextBox
  274. Width="230"
  275. Height="30"
  276. VerticalAlignment="Center"
  277. VerticalContentAlignment="Center"
  278. Background="Transparent"
  279. BorderBrush="#FF2AB2E7"
  280. BorderThickness="1"
  281. FontSize="16"
  282. Foreground="Orange"
  283. Style="{DynamicResource TextBoxStyle}"
  284. Text="{Binding RecipeName}" />
  285. </StackPanel>
  286. <StackPanel Orientation="Horizontal">
  287. <TextBlock
  288. Margin="10,0,5,0"
  289. VerticalAlignment="Center"
  290. FontSize="18"
  291. Foreground="#FF2AB2E7"
  292. Text="请输入桶的数量:" />
  293. <TextBox
  294. Width="230"
  295. Height="30"
  296. VerticalAlignment="Center"
  297. VerticalContentAlignment="Center"
  298. Background="Transparent"
  299. BorderBrush="#FF2AB2E7"
  300. BorderThickness="1"
  301. FontSize="16"
  302. Foreground="Orange"
  303. InputMethod.IsInputMethodEnabled="False"
  304. Style="{DynamicResource TextBoxStyle}"
  305. Text="{Binding RecipeRollerNum}"
  306. TextChanged="TextBox_TextChanged" />
  307. </StackPanel>
  308. </StackPanel>
  309. <Grid>
  310. <Grid.RowDefinitions>
  311. <RowDefinition />
  312. <RowDefinition />
  313. </Grid.RowDefinitions>
  314. <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
  315. <Button
  316. Width="180"
  317. Height="30"
  318. Margin="0,0,10,0"
  319. Background="Transparent"
  320. BorderBrush="#FF2AB2E7"
  321. Command="{Binding AddRecipe}"
  322. Content="添加原料"
  323. Cursor="Hand"
  324. Foreground="#FF2AB2E7" />
  325. <Button
  326. Width="180"
  327. Height="30"
  328. Background="Transparent"
  329. BorderBrush="#FF2AB2E7"
  330. Command="{Binding Comfirm}"
  331. Content="确认更新"
  332. Foreground="#FF2AB2E7" />
  333. </StackPanel>
  334. <StackPanel
  335. Grid.Row="1"
  336. HorizontalAlignment="Center"
  337. Orientation="Horizontal">
  338. <Button
  339. Width="180"
  340. Height="30"
  341. Margin="0,0,10,0"
  342. Command="{Binding SaveAs}"
  343. Content="另存为"
  344. Cursor="Hand" />
  345. <Button
  346. Width="180"
  347. Height="30"
  348. Background="Transparent"
  349. BorderBrush="#FF2AB2E7"
  350. Click="Button_Click"
  351. Content="取消"
  352. Cursor="Hand"
  353. FontSize="20"
  354. Foreground="#FF2AB2E7" />
  355. </StackPanel>
  356. </Grid>
  357. </UniformGrid>
  358. <Grid
  359. Grid.Row="2"
  360. Margin="0,0,0,10"
  361. Background="#FF2AB2E7">
  362. <Grid.ColumnDefinitions>
  363. <ColumnDefinition Width="210" />
  364. <ColumnDefinition Width="225" />
  365. <ColumnDefinition Width="225" />
  366. <ColumnDefinition />
  367. </Grid.ColumnDefinitions>
  368. <TextBlock
  369. HorizontalAlignment="Center"
  370. VerticalAlignment="Center"
  371. Foreground="White"
  372. Text="原料名称" />
  373. <GridSplitter />
  374. <TextBlock
  375. Grid.Column="1"
  376. HorizontalAlignment="Center"
  377. VerticalAlignment="Center"
  378. Foreground="White"
  379. Text="原料桶号" />
  380. <GridSplitter Grid.Column="1" />
  381. <TextBlock
  382. Grid.Column="2"
  383. HorizontalAlignment="Center"
  384. VerticalAlignment="Center"
  385. Foreground="White"
  386. Text="原料重量" />
  387. <GridSplitter Grid.Column="2" />
  388. <TextBlock
  389. Grid.Column="3"
  390. HorizontalAlignment="Center"
  391. VerticalAlignment="Center"
  392. Foreground="White"
  393. Text="操作" />
  394. </Grid>
  395. <ScrollViewer Grid.Row="3" VerticalScrollBarVisibility="Hidden">
  396. <ItemsControl ItemsSource="{Binding materials}">
  397. <ItemsControl.ItemsPanel>
  398. <ItemsPanelTemplate>
  399. <StackPanel />
  400. </ItemsPanelTemplate>
  401. </ItemsControl.ItemsPanel>
  402. <ItemsControl.ItemTemplate>
  403. <DataTemplate>
  404. <RadioButton>
  405. <RadioButton.Template>
  406. <ControlTemplate>
  407. <Grid>
  408. <Grid.ColumnDefinitions>
  409. <ColumnDefinition Width="210" />
  410. <ColumnDefinition Width="210" />
  411. <ColumnDefinition Width="225" />
  412. <ColumnDefinition />
  413. </Grid.ColumnDefinitions>
  414. <ComboBox
  415. Width="190"
  416. Height="30"
  417. Margin="10,0,0,10"
  418. FontSize="14"
  419. ItemsSource="{Binding DataContext.materialNames, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
  420. KeyUp="ComboBox_KeyUp"
  421. LostFocus="ComboBox_LostFocus"
  422. Style="{StaticResource ComboBoxStyle1}"
  423. Text="{Binding MaterialName}">
  424. <ComboBox.ItemContainerStyle>
  425. <Style TargetType="{x:Type ComboBoxItem}">
  426. <Setter Property="Background" Value="White" />
  427. <Setter Property="Foreground" Value="#e69519" />
  428. </Style>
  429. </ComboBox.ItemContainerStyle>
  430. </ComboBox>
  431. <StackPanel Grid.Column="1" Orientation="Horizontal">
  432. <TextBox
  433. Width="170"
  434. Height="30"
  435. Margin="35,0,0,10"
  436. Background="Transparent"
  437. BorderBrush="#e69519"
  438. FontSize="14"
  439. Foreground="LightGray"
  440. Text="{Binding MaterialLoc}" />
  441. </StackPanel>
  442. <StackPanel Grid.Column="2" Orientation="Horizontal">
  443. <TextBox
  444. Width="170"
  445. Height="30"
  446. Margin="35,0,0,10"
  447. Background="Transparent"
  448. BorderBrush="#e69519"
  449. FontSize="14"
  450. Foreground="LightGray"
  451. Text="{Binding MaterialWeight}" />
  452. <TextBlock
  453. Margin="4,0,0,10"
  454. VerticalAlignment="Center"
  455. FontSize="14"
  456. Foreground="#e69519"
  457. Text="g" />
  458. </StackPanel>
  459. <Button
  460. Grid.Column="3"
  461. Width="94"
  462. Height="30"
  463. Margin="0,0,20,10"
  464. HorizontalAlignment="Right"
  465. Background="Transparent"
  466. BorderBrush="#e69519"
  467. Command="{Binding DataContext.RemoveRecipe, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ItemsControl}}"
  468. CommandParameter="{Binding MaterialCode}"
  469. Content="删除"
  470. FontSize="14"
  471. Foreground="LightGray" />
  472. </Grid>
  473. </ControlTemplate>
  474. </RadioButton.Template>
  475. </RadioButton>
  476. </DataTemplate>
  477. </ItemsControl.ItemTemplate>
  478. </ItemsControl>
  479. </ScrollViewer>
  480. </Grid>
  481. </Border>
  482. </Window>