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

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