终端一体化运控平台
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.
 
 
 

412 rivejä
28 KiB

  1. <UserControl x:Class="BPASmart.RecipeManagement.View.PowerManager"
  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:BPASmart.RecipeManagement.View"
  7. xmlns:vm="clr-namespace:BPASmart.RecipeManagement.ViewModel"
  8. mc:Ignorable="d"
  9. d:DesignHeight="450" d:DesignWidth="800" Foreground="#FF2AB2E7" FontFamily="楷体">
  10. <UserControl.DataContext>
  11. <vm:PowerManagerViewModel/>
  12. </UserControl.DataContext>
  13. <UserControl.Resources>
  14. <ImageBrush x:Key="powerback" ImageSource="../Image/边框元素1.png"/>
  15. <ImageBrush x:Key="ImageBrushAddBlue" ImageSource="../Image/AddGreen.png"></ImageBrush>
  16. <ImageBrush x:Key="ImageBrushAddGray" ImageSource="../Image/Delete.png"></ImageBrush>
  17. <Style x:Key="ScrollBarPageButton" TargetType="{x:Type RepeatButton}">
  18. <Setter Property="SnapsToDevicePixels" Value="True" />
  19. <Setter Property="OverridesDefaultStyle" Value="true" />
  20. <Setter Property="IsTabStop" Value="false" />
  21. <Setter Property="Focusable" Value="false" />
  22. <Setter Property="Template">
  23. <Setter.Value>
  24. <ControlTemplate TargetType="{x:Type RepeatButton}">
  25. <Border Background="Transparent" />
  26. </ControlTemplate>
  27. </Setter.Value>
  28. </Setter>
  29. </Style>
  30. <Style x:Key="ItemContainer" TargetType="{x:Type ListBoxItem}">
  31. <Setter Property="Template">
  32. <Setter.Value>
  33. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  34. <Border x:Name="IconBorder" Background="Transparent" CornerRadius="4" BorderThickness="0">
  35. <ContentPresenter />
  36. </Border>
  37. <ControlTemplate.Triggers>
  38. <Trigger Property="IsSelected" Value="true">
  39. <Setter TargetName="IconBorder" Property="BitmapEffect">
  40. <Setter.Value>
  41. <OuterGlowBitmapEffect GlowColor="Transparent" GlowSize="5" />
  42. </Setter.Value>
  43. </Setter>
  44. </Trigger>
  45. </ControlTemplate.Triggers>
  46. </ControlTemplate>
  47. </Setter.Value>
  48. </Setter>
  49. </Style>
  50. <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}">
  51. <Setter Property="SnapsToDevicePixels" Value="True" />
  52. <Setter Property="OverridesDefaultStyle" Value="true" />
  53. <Setter Property="IsTabStop" Value="false" />
  54. <Setter Property="Focusable" Value="false" />
  55. <Setter Property="Template">
  56. <Setter.Value>
  57. <ControlTemplate TargetType="{x:Type Thumb}">
  58. <Border CornerRadius="2" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="1" />
  59. </ControlTemplate>
  60. </Setter.Value>
  61. </Setter>
  62. </Style>
  63. <ControlTemplate x:Key="VerticalScrollBar" TargetType="{x:Type ScrollBar}">
  64. <Grid>
  65. <Border CornerRadius="2" Width="0.5" Background="#FF046BFF" />
  66. <Track x:Name="PART_Track" IsDirectionReversed="true">
  67. <Track.DecreaseRepeatButton>
  68. <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageUpCommand" />
  69. </Track.DecreaseRepeatButton>
  70. <Track.Thumb>
  71. <Thumb Style="{StaticResource ScrollBarThumb}" Margin="4,0,4,0" Background="DodgerBlue"></Thumb>
  72. </Track.Thumb>
  73. <Track.IncreaseRepeatButton>
  74. <RepeatButton Style="{StaticResource ScrollBarPageButton}" Command="ScrollBar.PageDownCommand" />
  75. </Track.IncreaseRepeatButton>
  76. </Track>
  77. </Grid>
  78. </ControlTemplate>
  79. <ControlTemplate x:Key="ScrollViewerControlTemplate1" TargetType="{x:Type ScrollViewer}">
  80. <Grid x:Name="Grid" Background="{TemplateBinding Background}">
  81. <Grid.ColumnDefinitions>
  82. <ColumnDefinition Width="*"/>
  83. <ColumnDefinition Width="Auto"/>
  84. </Grid.ColumnDefinitions>
  85. <Grid.RowDefinitions>
  86. <RowDefinition Height="*"/>
  87. <RowDefinition Height="Auto"/>
  88. </Grid.RowDefinitions>
  89. <Rectangle x:Name="Corner" Grid.Column="1" Fill="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" Grid.Row="1"/>
  90. <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/>
  91. <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1"
  92. Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}"
  93. Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"
  94. Template="{StaticResource VerticalScrollBar}"/>
  95. <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}"/>
  96. </Grid>
  97. </ControlTemplate>
  98. </UserControl.Resources>
  99. <Border>
  100. <Border.Background>
  101. <ImageBrush ImageSource="../image/背景.png"/>
  102. </Border.Background>
  103. <Grid Margin="0,10">
  104. <Grid.RowDefinitions>
  105. <RowDefinition Height="40"/>
  106. <RowDefinition Height="20"/>
  107. <RowDefinition Height="40"/>
  108. <RowDefinition />
  109. </Grid.RowDefinitions>
  110. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
  111. <TextBlock Text="选择用户" FontSize="22" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="20,0"/>
  112. <ComboBox Width="120" Margin="20,0" ItemsSource="{Binding UserName }" FontSize="16" Foreground="#FF2AB2E7"/>
  113. <Button Style="{DynamicResource ButtonStyle}" Margin="20,0" Content="保 存"
  114. FontSize="18" Height="30" Width="120"
  115. Command="{Binding SaveCommand}" CommandParameter="Materials">
  116. </Button>
  117. </StackPanel>
  118. <Grid Grid.Row="2">
  119. <Grid.ColumnDefinitions>
  120. <ColumnDefinition/>
  121. <ColumnDefinition/>
  122. </Grid.ColumnDefinitions>
  123. <Border Width="150">
  124. <Border.Background>
  125. <ImageBrush ImageSource="../Image/元素1.png"/>
  126. </Border.Background>
  127. <TextBlock Text="原料权限" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5" />
  128. </Border>
  129. <Border Width="150" Grid.Column="1">
  130. <Border.Background>
  131. <ImageBrush ImageSource="../Image/元素1.png"/>
  132. </Border.Background>
  133. <TextBlock Text="配方权限" FontSize="20" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="5" />
  134. </Border>
  135. </Grid>
  136. <Grid Grid.Row="3" Margin="5,10,5,50">
  137. <Grid.ColumnDefinitions>
  138. <ColumnDefinition/>
  139. <ColumnDefinition Width="80"/>
  140. <ColumnDefinition/>
  141. <ColumnDefinition Width="20"/>
  142. <ColumnDefinition/>
  143. <ColumnDefinition Width="80"/>
  144. <ColumnDefinition/>
  145. </Grid.ColumnDefinitions>
  146. <!--#region原料权限-->
  147. <Border Grid.Column="0" Margin="10,0,10,0" CornerRadius="5" Background="{DynamicResource powerback}" >
  148. <ScrollViewer Margin="20,42" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True"
  149. Width="auto">
  150. <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
  151. ItemsSource="{Binding AllMaterials}" >
  152. <ListBox.Template>
  153. <ControlTemplate>
  154. <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
  155. </ControlTemplate>
  156. </ListBox.Template>
  157. <ListBox.ItemTemplate>
  158. <DataTemplate>
  159. <Grid Height="28" Margin="5">
  160. <Grid.ColumnDefinitions>
  161. <ColumnDefinition Width="*"></ColumnDefinition>
  162. <ColumnDefinition Width="60"></ColumnDefinition>
  163. </Grid.ColumnDefinitions>
  164. <TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" />
  165. <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
  166. Command="{Binding DataContext.AddMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
  167. CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
  168. <Button.Template>
  169. <ControlTemplate TargetType="Button">
  170. <Grid>
  171. <Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
  172. <Rectangle.Fill>
  173. <ImageBrush ImageSource="../Image/AddGreen.png"></ImageBrush>
  174. </Rectangle.Fill>
  175. </Rectangle>
  176. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  177. </Grid>
  178. <ControlTemplate.Triggers>
  179. <Trigger Property="IsMouseOver" Value="True">
  180. <Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter>
  181. <Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter>
  182. </Trigger>
  183. </ControlTemplate.Triggers>
  184. </ControlTemplate>
  185. </Button.Template>
  186. </Button>
  187. </Grid>
  188. </DataTemplate>
  189. </ListBox.ItemTemplate>
  190. </ListBox>
  191. </ScrollViewer>
  192. </Border>
  193. <StackPanel Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" >
  194. <Button
  195. FontSize="14" Height="30" Width="100" Margin="0,20" VerticalAlignment="Center" HorizontalAlignment="Center"
  196. Command="{Binding AddAllCommand}" CommandParameter="Materials" Style="{DynamicResource GreenButton}" >
  197. <Grid>
  198. <Grid.ColumnDefinitions>
  199. <ColumnDefinition Width="auto"/>
  200. <ColumnDefinition Width="auto"/>
  201. </Grid.ColumnDefinitions>
  202. <Image Source="../Image/增加.png" Width="15" Margin="2"/>
  203. <TextBlock Grid.Column="1" Text="全部添加" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  204. </Grid>
  205. </Button>
  206. <Button Style="{DynamicResource DeleteButton}" VerticalAlignment="Center" HorizontalAlignment="Center"
  207. FontSize="18" Height="30" Width="100" Margin="0,20"
  208. Command="{Binding DeleteAllCommand}" CommandParameter="Materials">
  209. <Grid>
  210. <Grid.ColumnDefinitions>
  211. <ColumnDefinition Width="auto"/>
  212. <ColumnDefinition Width="auto"/>
  213. </Grid.ColumnDefinitions>
  214. <Image Source="../Image/移除.png" Width="15" Margin="2"/>
  215. <TextBlock Grid.Column="1" Text="全部移除" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center" />
  216. </Grid>
  217. </Button>
  218. </StackPanel>
  219. <Border Grid.Column="2" Background="{DynamicResource powerback}" Margin="10,0,10,0">
  220. <ScrollViewer Grid.Column="2" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" Margin="20,42">
  221. <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}" Width="auto"
  222. ItemsSource="{Binding UserMaterials}" >
  223. <ListBox.Template>
  224. <ControlTemplate>
  225. <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
  226. </ControlTemplate>
  227. </ListBox.Template>
  228. <ListBox.ItemTemplate>
  229. <DataTemplate>
  230. <Grid Height="28" Margin="5">
  231. <Grid.ColumnDefinitions>
  232. <ColumnDefinition Width="*"></ColumnDefinition>
  233. <ColumnDefinition Width="60"></ColumnDefinition>
  234. </Grid.ColumnDefinitions>
  235. <TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" />
  236. <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
  237. Command="{Binding DataContext.DeleteMaterialCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
  238. CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
  239. <Button.Template>
  240. <ControlTemplate TargetType="Button">
  241. <Grid>
  242. <Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
  243. <Rectangle.Fill>
  244. <ImageBrush ImageSource="../Image/Delete.png"></ImageBrush>
  245. </Rectangle.Fill>
  246. </Rectangle>
  247. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  248. </Grid>
  249. <ControlTemplate.Triggers>
  250. <Trigger Property="IsMouseOver" Value="True">
  251. <Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter>
  252. <Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter>
  253. </Trigger>
  254. </ControlTemplate.Triggers>
  255. </ControlTemplate>
  256. </Button.Template>
  257. </Button>
  258. </Grid>
  259. </DataTemplate>
  260. </ListBox.ItemTemplate>
  261. </ListBox>
  262. </ScrollViewer>
  263. </Border>
  264. <!--#endregion-->
  265. <!--#region 配方权限-->
  266. <Border Grid.Column="4" Background="{DynamicResource powerback}" Margin="10,0,10,0">
  267. <ScrollViewer Margin="20,42" Grid.Column="4" Width="auto" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True" >
  268. <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
  269. ItemsSource="{Binding AllRecipes}" >
  270. <ListBox.Template>
  271. <ControlTemplate>
  272. <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
  273. </ControlTemplate>
  274. </ListBox.Template>
  275. <ListBox.ItemTemplate>
  276. <DataTemplate>
  277. <Grid Height="28" Margin="5">
  278. <Grid.ColumnDefinitions>
  279. <ColumnDefinition Width="*"></ColumnDefinition>
  280. <ColumnDefinition Width="60"></ColumnDefinition>
  281. </Grid.ColumnDefinitions>
  282. <TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" />
  283. <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
  284. Command="{Binding DataContext.AddRecipeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
  285. CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
  286. <Button.Template>
  287. <ControlTemplate TargetType="Button">
  288. <Grid>
  289. <Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
  290. <Rectangle.Fill>
  291. <ImageBrush ImageSource="../Image/AddGreen.png"></ImageBrush>
  292. </Rectangle.Fill>
  293. </Rectangle>
  294. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  295. </Grid>
  296. <ControlTemplate.Triggers>
  297. <Trigger Property="IsMouseOver" Value="True">
  298. <Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter>
  299. <Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter>
  300. </Trigger>
  301. </ControlTemplate.Triggers>
  302. </ControlTemplate>
  303. </Button.Template>
  304. </Button>
  305. </Grid>
  306. </DataTemplate>
  307. </ListBox.ItemTemplate>
  308. </ListBox>
  309. </ScrollViewer>
  310. </Border>
  311. <StackPanel Grid.Column="5" HorizontalAlignment="Center" VerticalAlignment="Center">
  312. <Button Style="{DynamicResource GreenButton}" HorizontalAlignment="Center" VerticalAlignment="Center"
  313. FontSize="18" Height="30" Width="80" Margin="0,20"
  314. Command="{Binding AddAllCommand}" CommandParameter="Recipes">
  315. <Grid>
  316. <Grid.ColumnDefinitions>
  317. <ColumnDefinition Width="auto"/>
  318. <ColumnDefinition Width="auto"/>
  319. </Grid.ColumnDefinitions>
  320. <Image Source="../Image/增加.png" Width="15" Margin="2"/>
  321. <TextBlock Grid.Column="1" Text="全部添加" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center"/>
  322. </Grid>
  323. </Button>
  324. <Button Style="{DynamicResource DeleteButton}" HorizontalAlignment="Center" VerticalAlignment="Center"
  325. FontSize="18" Height="30" Width="80" Margin="0,20"
  326. Command="{Binding DeleteAllCommand}" CommandParameter="Recipes">
  327. <Grid>
  328. <Grid.ColumnDefinitions>
  329. <ColumnDefinition Width="auto"/>
  330. <ColumnDefinition Width="auto"/>
  331. </Grid.ColumnDefinitions>
  332. <Image Source="../Image/移除.png" Width="15" Margin="2"/>
  333. <TextBlock Grid.Column="1" Text="全部移除" FontSize="15" HorizontalAlignment="Center" VerticalAlignment="Center" />
  334. </Grid>
  335. </Button>
  336. </StackPanel>
  337. <Border Grid.Column="6" Background="{DynamicResource powerback}" Margin="10,0,10,0">
  338. <ScrollViewer Grid.Column="6" Margin="20,42" Template="{StaticResource ScrollViewerControlTemplate1}" CanContentScroll="True">
  339. <ListBox Background="Transparent" ItemContainerStyle="{StaticResource ItemContainer}" FocusVisualStyle="{x:Null}"
  340. Width="auto"
  341. ItemsSource="{Binding UserRecipes}" >
  342. <ListBox.Template>
  343. <ControlTemplate>
  344. <StackPanel Background="Transparent" IsItemsHost="True"></StackPanel>
  345. </ControlTemplate>
  346. </ListBox.Template>
  347. <ListBox.ItemTemplate>
  348. <DataTemplate>
  349. <Grid Height="28" Margin="5">
  350. <Grid.ColumnDefinitions>
  351. <ColumnDefinition Width="*"></ColumnDefinition>
  352. <ColumnDefinition Width="60"></ColumnDefinition>
  353. </Grid.ColumnDefinitions>
  354. <TextBlock x:Name="tb_Name" Text="{Binding Name}" Foreground="White" FontSize="18" VerticalAlignment="Center" HorizontalAlignment="Left" />
  355. <Button x:Name="BtnDelete" Grid.Column="1" Background="Transparent" ToolTip="移除" VerticalAlignment="Center" HorizontalAlignment="Left"
  356. Command="{Binding DataContext.DeleteRecipeCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}"
  357. CommandParameter="{Binding Path=Text,ElementName=tb_Name}">
  358. <Button.Template>
  359. <ControlTemplate TargetType="Button">
  360. <Grid>
  361. <Rectangle x:Name="BtnRetangle" Height="21" Width="21" Stroke="Transparent" StrokeThickness="1" VerticalAlignment="Center" HorizontalAlignment="Left">
  362. <Rectangle.Fill>
  363. <ImageBrush ImageSource="../Image/Delete.png"></ImageBrush>
  364. </Rectangle.Fill>
  365. </Rectangle>
  366. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" Content="{TemplateBinding Content}"></ContentPresenter>
  367. </Grid>
  368. <ControlTemplate.Triggers>
  369. <Trigger Property="IsMouseOver" Value="True">
  370. <Setter TargetName="BtnRetangle" Property="Height" Value="24"></Setter>
  371. <Setter TargetName="BtnRetangle" Property="Width" Value="24"></Setter>
  372. </Trigger>
  373. </ControlTemplate.Triggers>
  374. </ControlTemplate>
  375. </Button.Template>
  376. </Button>
  377. </Grid>
  378. </DataTemplate>
  379. </ListBox.ItemTemplate>
  380. </ListBox>
  381. </ScrollViewer>
  382. </Border>
  383. <!--#endregion-->
  384. </Grid>
  385. </Grid>
  386. </Border>
  387. </UserControl>