FlowEditorShellView.xaml 5.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <UserControl x:Class="TeamAAS.FlowEditor.FlowEditorShellView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:hc="https://handyorg.github.io/handycontrol"
  5. xmlns:fe="clr-namespace:TeamAAS.FlowEditor"
  6. xmlns:conv="clr-namespace:TeamAAS.FlowEditor.Converters">
  7. <UserControl.Resources>
  8. <!-- bool 取反:只读模式禁用新增流程按钮 -->
  9. <conv:InverseBoolConverter x:Key="InverseBoolConverter"/>
  10. <!-- Tab样式 -->
  11. <Style x:Key="FlowTabItemBorder" TargetType="Border">
  12. <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/>
  13. <Setter Property="Padding" Value="14,6"/>
  14. <Setter Property="Cursor" Value="Hand"/>
  15. <Setter Property="Width" Value="Auto"/>
  16. <Setter Property="MinWidth" Value="120"/>
  17. <Setter Property="MinHeight" Value="50"/>
  18. <Style.Triggers>
  19. <DataTrigger Binding="{Binding IsActive}" Value="True">
  20. <Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/>
  21. </DataTrigger>
  22. </Style.Triggers>
  23. </Style>
  24. <Style x:Key="FlowTabText" TargetType="TextBlock">
  25. <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
  26. <Setter Property="FontSize" Value="12"/>
  27. <Setter Property="VerticalAlignment" Value="Center"/>
  28. <Style.Triggers>
  29. <DataTrigger Binding="{Binding IsActive}" Value="True">
  30. <Setter Property="Foreground" Value="White"/>
  31. </DataTrigger>
  32. </Style.Triggers>
  33. </Style>
  34. </UserControl.Resources>
  35. <DockPanel>
  36. <!-- Tab栏 -->
  37. <Border DockPanel.Dock="Top" Height="34"
  38. Background="{DynamicResource RegionBrush}"
  39. BorderBrush="{DynamicResource BorderBrush}" BorderThickness="0,0,0,1">
  40. <DockPanel>
  41. <CheckBox DockPanel.Dock="Right" Content="监控当前流程"
  42. Command="{Binding ToggleMonitorCommand}"
  43. IsChecked="{Binding IsMonitorMode, Mode=OneWay}"
  44. IsEnabled="{Binding IsMonitorOptionAvailable}"
  45. VerticalAlignment="Center" Margin="8,0,4,0"
  46. ToolTip="仅当前产品==运行产品且正在运行时可用:勾选挂接运行态显示实时状态;切到运行产品会自动开启"/>
  47. <Button DockPanel.Dock="Right" Content="+" Width="28" Height="26"
  48. Command="{Binding AddFlowCommand}" ToolTip="新增流程"
  49. IsEnabled="{Binding IsReadOnly, Converter={StaticResource InverseBoolConverter}}"
  50. Margin="0,0,4,0" VerticalAlignment="Center"/>
  51. <ItemsControl ItemsSource="{Binding FlowTabs}">
  52. <ItemsControl.ItemsPanel>
  53. <ItemsPanelTemplate>
  54. <StackPanel Orientation="Horizontal"/>
  55. </ItemsPanelTemplate>
  56. </ItemsControl.ItemsPanel>
  57. <ItemsControl.ItemTemplate>
  58. <DataTemplate>
  59. <Border Style="{StaticResource FlowTabItemBorder}" Margin="0,0,1,0"
  60. MouseLeftButtonDown="TabItem_MouseLeftButtonDown"
  61. VerticalAlignment="Center"
  62. MouseRightButtonDown="TabItem_MouseRightButtonDown">
  63. <Grid >
  64. <TextBlock Text="{Binding Name}" FontSize="18" Style="{StaticResource FlowTabText}" Margin="0,0,10,0"
  65. ToolTip="双击重命名" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  66. <TextBlock Text="✕" FontSize="18" Cursor="Hand"
  67. Foreground="{DynamicResource SecondaryTextBrush}"
  68. VerticalAlignment="Center"
  69. HorizontalAlignment="Right"
  70. MouseLeftButtonDown="TabClose_MouseLeftButtonDown"
  71. ToolTip="关闭"/>
  72. </Grid>
  73. </Border>
  74. </DataTemplate>
  75. </ItemsControl.ItemTemplate>
  76. </ItemsControl>
  77. </DockPanel>
  78. </Border>
  79. <!-- 当前选中的流程编辑器 -->
  80. <ContentControl Content="{Binding ActiveEditorVm}">
  81. <ContentControl.ContentTemplate>
  82. <DataTemplate DataType="{x:Type fe:FlowEditorViewModel}">
  83. <fe:FlowEditorView/>
  84. </DataTemplate>
  85. </ContentControl.ContentTemplate>
  86. </ContentControl>
  87. </DockPanel>
  88. </UserControl>