RecipeView.xaml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  1. <UserControl
  2. x:Class="FurnaceUI.Views.Recipes.RecipeView"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:editors="clr-namespace:MECF.Framework.UI.Client.CenterViews.Editors;assembly=MECF.Framework.UI.Client"
  7. xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
  8. xmlns:local="clr-namespace:FurnaceUI.Views.Recipes"
  9. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  10. xmlns:micro="http://www.caliburn.org"
  11. Width="1280"
  12. Height="820"
  13. FontFamily="Segoe"
  14. mc:Ignorable="d">
  15. <UserControl.Resources>
  16. <HierarchicalDataTemplate x:Key="FolderTemplate" ItemsSource="{Binding Files}">
  17. <StackPanel Orientation="Horizontal" Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=DataContext}">
  18. <Image
  19. x:Name="ExpandImage"
  20. Width="14"
  21. Height="12"
  22. Margin="2,0,0,0"
  23. VerticalAlignment="Center"
  24. Source="/MECF.Framework.UI.Client;component/Resources/Images/Folder_Close.png"/>
  25. <TextBlock
  26. Width="250"
  27. Margin="5,0,0,0"
  28. HorizontalAlignment="Left"
  29. VerticalAlignment="Center"
  30. FontSize="15"
  31. Text="{Binding Name}"/>
  32. </StackPanel>
  33. <HierarchicalDataTemplate.Triggers>
  34. <Trigger Property="IsEnabled" Value="false">
  35. <Setter TargetName="ExpandImage" Property="Image.Source" Value="/MECF.Framework.UI.Client;component/Resources/Images/Folder_Unable.png"/>
  36. </Trigger>
  37. </HierarchicalDataTemplate.Triggers>
  38. </HierarchicalDataTemplate>
  39. <HierarchicalDataTemplate x:Key="FileTemplate" ItemsSource="{Binding Files}">
  40. <StackPanel Orientation="Horizontal" Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=DataContext}">
  41. <Path
  42. Width="13"
  43. Height="16"
  44. HorizontalAlignment="Left"
  45. Data="M0.5,5.125 L5.125,5.125 5.125,0.5 M5.1,0.5 L15.5,0.5 15.5,19.5 0.5,19.5 C0.5,14.7 0.5,10 0.5,5.1 2,3.6 3.6,2 5.1,0.5 z M8.1,8.5 L8.2,8.5 z M8.1,11.5 L8.2,11.5 z M8.1,14.5 L8.2,14.5 z"
  46. Fill="#FFF3F3F3"
  47. Stretch="Fill"
  48. Stroke="#FF454545"/>
  49. <TextBlock
  50. Width="240"
  51. HorizontalAlignment="Left"
  52. VerticalAlignment="Center"
  53. FontFamily="Segoe"
  54. FontSize="15"
  55. Text="{Binding Name}"
  56. TextAlignment="Left"
  57. TextWrapping="Wrap"/>
  58. <TextBlock
  59. Width="100"
  60. HorizontalAlignment="Center"
  61. VerticalAlignment="Center"
  62. FontSize="15"
  63. Text="{Binding Level}"
  64. TextAlignment="Center"/>
  65. <TextBlock
  66. Width="100"
  67. HorizontalAlignment="Center"
  68. VerticalAlignment="Center"
  69. FontSize="15"
  70. Text="{Binding Revisor}"
  71. TextAlignment="Center"/>
  72. <TextBlock
  73. Width="280"
  74. HorizontalAlignment="Center"
  75. VerticalAlignment="Center"
  76. FontSize="15"
  77. Text="{Binding Description}"
  78. TextAlignment="Center"/>
  79. <TextBlock
  80. Width="210"
  81. HorizontalAlignment="Center"
  82. VerticalAlignment="Center"
  83. FontSize="15"
  84. Text="{Binding ReviseTime}"
  85. TextAlignment="Center"/>
  86. </StackPanel>
  87. </HierarchicalDataTemplate>
  88. <editors:FolderOrFileTemplateSelector
  89. x:Key="FolderFileTemplateSelector"
  90. FileTemplate="{StaticResource FileTemplate}"
  91. FolderTemplate="{StaticResource FolderTemplate}"/>
  92. <Style BasedOn="{StaticResource ExScrollViewer}" TargetType="ScrollViewer"/>
  93. <Style BasedOn="{StaticResource ExScrollBar}" TargetType="ScrollBar"/>
  94. </UserControl.Resources>
  95. <Grid IsEnabled="{Binding IsPermission}">
  96. <Grid.ColumnDefinitions>
  97. <ColumnDefinition Width="*"/>
  98. <ColumnDefinition Width="200"/>
  99. </Grid.ColumnDefinitions>
  100. <TabControl
  101. Grid.Column="0"
  102. Margin="0,-1,0,-10"
  103. Padding="0"
  104. VerticalAlignment="Stretch"
  105. HorizontalContentAlignment="Stretch"
  106. VerticalContentAlignment="Stretch"
  107. ItemsSource="{Binding ProcessTypeFileList}"
  108. SelectedIndex="{Binding ProcessTypeIndexSelection, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
  109. <TabControl.ItemContainerStyle>
  110. <Style TargetType="{x:Type TabItem}">
  111. <Setter Property="Visibility" Value="Collapsed"/>
  112. </Style>
  113. </TabControl.ItemContainerStyle>
  114. <TabControl.ItemTemplate>
  115. <DataTemplate>
  116. <TextBlock>
  117. <TextBlock.Text>
  118. <MultiBinding StringFormat="{}{0} {1}">
  119. <Binding Path="ProcessType"/>
  120. <Binding Source="Recipe"/>
  121. </MultiBinding>
  122. </TextBlock.Text>
  123. </TextBlock>
  124. </DataTemplate>
  125. </TabControl.ItemTemplate>
  126. <TabControl.ContentTemplate>
  127. <DataTemplate>
  128. <ScrollViewer
  129. Width="Auto"
  130. Height="Auto"
  131. Margin="5,0,0,0"
  132. HorizontalAlignment="Left"
  133. CanContentScroll="True"
  134. HorizontalScrollBarVisibility="Hidden"
  135. PanningMode="VerticalOnly"
  136. VerticalScrollBarVisibility="Auto">
  137. <Grid>
  138. <Grid.RowDefinitions>
  139. <RowDefinition Height="30"/>
  140. <RowDefinition Height="*"/>
  141. </Grid.RowDefinitions>
  142. <Grid.ColumnDefinitions>
  143. <ColumnDefinition MinWidth="300"/>
  144. <ColumnDefinition Width="100"/>
  145. <ColumnDefinition Width="105"/>
  146. <ColumnDefinition Width="310"/>
  147. <ColumnDefinition Width="250"/>
  148. </Grid.ColumnDefinitions>
  149. <Border
  150. Grid.Column="0"
  151. BorderBrush="Black"
  152. BorderThickness="0,0,1,1">
  153. <TextBlock
  154. Margin="0,0,0,0"
  155. Style="{StaticResource TextBlock_Top}"
  156. Text="Name"
  157. TextAlignment="Center"/>
  158. </Border>
  159. <Border
  160. Grid.Column="1"
  161. BorderBrush="Black"
  162. BorderThickness="0,0,1,1">
  163. <TextBlock
  164. Margin="0,0,0,0"
  165. Block.TextAlignment="Center"
  166. Style="{StaticResource TextBlock_Top}"
  167. Text="Level"/>
  168. </Border>
  169. <Border
  170. Grid.Column="2"
  171. BorderBrush="Black"
  172. BorderThickness="0,0,1,1">
  173. <TextBlock
  174. Margin="0,0,0,0"
  175. Block.TextAlignment="Center"
  176. Style="{StaticResource TextBlock_Top}"
  177. Text="Owner"/>
  178. </Border>
  179. <!--<Border Grid.Column="3" BorderBrush="Black" BorderThickness="0,0,1,1">
  180. <TextBlock Style="{StaticResource TextBlock_Top}" Block.TextAlignment="Center" Text="Permission" Margin="0,0,0,0"/>
  181. </Border>-->
  182. <Border
  183. Grid.Column="3"
  184. BorderBrush="Black"
  185. BorderThickness="0,0,1,1">
  186. <TextBlock
  187. Margin="0,0,0,0"
  188. Block.TextAlignment="Center"
  189. Style="{StaticResource TextBlock_Top}"
  190. Text="Description"/>
  191. </Border>
  192. <Border
  193. Grid.Column="4"
  194. BorderBrush="Black"
  195. BorderThickness="0,0,1,1">
  196. <TextBlock
  197. Margin="0,0,0,0"
  198. Block.TextAlignment="Center"
  199. Style="{StaticResource TextBlock_Top}"
  200. Text="Date"/>
  201. </Border>
  202. <!-- Height="{Binding Path=ActualHeight, ElementName=PART_BORDER, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}" -->
  203. <TreeView
  204. x:Name="RecipeTree1"
  205. Grid.Row="1"
  206. Grid.ColumnSpan="6"
  207. Height="790"
  208. Margin="0"
  209. VerticalAlignment="Stretch"
  210. ItemTemplateSelector="{StaticResource FolderFileTemplateSelector}"
  211. ItemsSource="{Binding FileListByProcessType}"
  212. ScrollViewer.CanContentScroll="True"
  213. ScrollViewer.HorizontalScrollBarVisibility="Hidden"
  214. ScrollViewer.PanningMode="VerticalOnly"
  215. ScrollViewer.VerticalScrollBarVisibility="Visible"
  216. Tag="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=DataContext}"
  217. VirtualizingPanel.IsVirtualizing="True"
  218. VirtualizingPanel.VirtualizationMode="Recycling">
  219. <TreeView.ItemContainerStyle>
  220. <Style BasedOn="{StaticResource TreeViewItemExtend}" TargetType="{x:Type TreeViewItem}">
  221. <Setter Property="local:BringSelectedItemIntoViewBehavior.IsBringSelectedIntoView" Value="True"/>
  222. <Setter Property="IsExpanded" Value="True"/>
  223. <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}"/>
  224. </Style>
  225. </TreeView.ItemContainerStyle>
  226. <i:Interaction.Triggers>
  227. <i:EventTrigger EventName="SelectedItemChanged">
  228. <micro:ActionMessage MethodName="TreeSelectChanged">
  229. <micro:Parameter Value="{Binding SelectedItem, ElementName=RecipeTree1}"/>
  230. </micro:ActionMessage>
  231. </i:EventTrigger>
  232. </i:Interaction.Triggers>
  233. </TreeView>
  234. </Grid>
  235. </ScrollViewer>
  236. </DataTemplate>
  237. </TabControl.ContentTemplate>
  238. <i:Interaction.Triggers>
  239. <i:EventTrigger EventName="SelectionChanged">
  240. <micro:ActionMessage MethodName="TabSelectionChanged"/>
  241. </i:EventTrigger>
  242. </i:Interaction.Triggers>
  243. </TabControl>
  244. <Grid Grid.Column="1" Margin="0,13">
  245. <Grid.RowDefinitions>
  246. <RowDefinition Height="0"/>
  247. <RowDefinition/>
  248. <RowDefinition/>
  249. <RowDefinition/>
  250. <RowDefinition/>
  251. <RowDefinition/>
  252. <RowDefinition/>
  253. <RowDefinition/>
  254. <RowDefinition/>
  255. <RowDefinition/>
  256. <RowDefinition/>
  257. <RowDefinition/>
  258. <RowDefinition/>
  259. </Grid.RowDefinitions>
  260. <Button
  261. Grid.Row="0"
  262. Margin="10,3"
  263. Command="{Binding SelectRecipeTypeCommand}"
  264. Content="Select Recipe Type"
  265. Visibility="Hidden"/>
  266. <Button
  267. Grid.Row="1"
  268. Margin="10,3"
  269. Command="{Binding NewFolderCommand}"
  270. Content="New Folder" />
  271. <Button
  272. Grid.Row="2"
  273. Margin="10,3"
  274. Command="{Binding DeleteFolderCommand}"
  275. Content="Delete Folder"
  276. IsEnabled="{Binding IsEnabledFolderPermission, UpdateSourceTrigger=PropertyChanged}"/>
  277. <Button
  278. Grid.Row="3"
  279. Margin="10,3"
  280. Command="{Binding RenameFolderCommand}"
  281. Content="Rename Folder"
  282. IsEnabled="{Binding IsEnabledFolderPermission, UpdateSourceTrigger=PropertyChanged}"/>
  283. <Button
  284. Grid.Row="4"
  285. Margin="10,3"
  286. Command="{Binding NewRecipeCommand}"
  287. Content="New Recipe"/>
  288. <Button
  289. Grid.Row="5"
  290. Margin="10,3"
  291. Command="{Binding DeleteRecipeCommand}"
  292. Content="Delete Recipe"
  293. IsEnabled="{Binding IsSelectPermission, UpdateSourceTrigger=PropertyChanged}"/>
  294. <Button
  295. Grid.Row="6"
  296. Margin="10,3"
  297. Command="{Binding EditRecipeCommand}"
  298. Content="Edit Recipe"
  299. IsEnabled="{Binding IsSelectPermission, UpdateSourceTrigger=PropertyChanged}"/>
  300. <Button
  301. Grid.Row="7"
  302. Margin="10,3"
  303. Command="{Binding RenameRecipeCommand}"
  304. Content="Rename Recipe"
  305. IsEnabled="{Binding IsSelectPermission, UpdateSourceTrigger=PropertyChanged}"/>
  306. <Button
  307. Grid.Row="8"
  308. Margin="10,3"
  309. Command="{Binding SaveAsRecipeCommand}"
  310. Content="Copy Recipe"
  311. IsEnabled="{Binding IsSelectPermission, UpdateSourceTrigger=PropertyChanged}"/>
  312. <Button
  313. Grid.Row="9"
  314. Margin="10,3"
  315. Command="{Binding ViewRecipeCommand}"
  316. Content="View Recipe"
  317. IsEnabled="{Binding IsSelectPermission, UpdateSourceTrigger=PropertyChanged}"/>
  318. <Button
  319. Grid.Row="11"
  320. Margin="10,3"
  321. Command="{Binding ChangePermission}"
  322. Content="Change Property"
  323. IsEnabled="{Binding IsSelectPermission, UpdateSourceTrigger=PropertyChanged}"/>
  324. <Button
  325. Grid.Row="10"
  326. Margin="10,3"
  327. Command="{Binding ExportRecipeCommand}"
  328. Content="Export"
  329. IsEnabled="{Binding IsSelectPermission, UpdateSourceTrigger=PropertyChanged}"/>
  330. <Button
  331. Grid.Row="12"
  332. Margin="10,3"
  333. Command="{Binding HistoryRecipeCommand}"
  334. Content="History"
  335. IsEnabled="{Binding IsSelectPermission, UpdateSourceTrigger=PropertyChanged}"/>
  336. </Grid>
  337. </Grid>
  338. </UserControl>