360 lines
20 KiB
XML
360 lines
20 KiB
XML
<UserControl
|
|
x:Class="XplorePlane.Views.PipelineEditorView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
d:DesignHeight="700"
|
|
d:DesignWidth="350"
|
|
mc:Ignorable="d">
|
|
|
|
<UserControl.Resources>
|
|
<SolidColorBrush x:Key="PanelBg" Color="White" />
|
|
<SolidColorBrush x:Key="PanelBorder" Color="#CDCBCB" />
|
|
<SolidColorBrush x:Key="SeparatorBrush" Color="#E0E0E0" />
|
|
<SolidColorBrush x:Key="AccentBlue" Color="#D9ECFF" />
|
|
<SolidColorBrush x:Key="DisabledNodeBg" Color="#F3F3F3" />
|
|
<SolidColorBrush x:Key="DisabledNodeLine" Color="#B9B9B9" />
|
|
<SolidColorBrush x:Key="DisabledNodeText" Color="#8A8A8A" />
|
|
<FontFamily x:Key="CsdFont">Microsoft YaHei UI</FontFamily>
|
|
|
|
<Style x:Key="PipelineNodeItemStyle" TargetType="ListBoxItem">
|
|
<Setter Property="Padding" Value="0" />
|
|
<Setter Property="Margin" Value="0" />
|
|
<Setter Property="Focusable" Value="False" />
|
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="BorderBrush" Value="Transparent" />
|
|
<Setter Property="BorderThickness" Value="0" />
|
|
<Style.Triggers>
|
|
<Trigger Property="IsSelected" Value="True">
|
|
<Setter Property="Background" Value="{StaticResource AccentBlue}" />
|
|
<Setter Property="BorderBrush" Value="#5B9BD5" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style x:Key="ToolbarBtn" TargetType="Button">
|
|
<Setter Property="Width" Value="52" />
|
|
<Setter Property="Height" Value="28" />
|
|
<Setter Property="Margin" Value="2,0" />
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="BorderBrush" Value="#CDCBCB" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="FontFamily" Value="Microsoft YaHei UI" />
|
|
<Setter Property="FontSize" Value="11" />
|
|
<Setter Property="Cursor" Value="Hand" />
|
|
</Style>
|
|
</UserControl.Resources>
|
|
|
|
<Border
|
|
Background="{StaticResource PanelBg}"
|
|
BorderBrush="{StaticResource PanelBorder}"
|
|
BorderThickness="1"
|
|
CornerRadius="4">
|
|
<Grid>
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="4*" MinHeight="180" />
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="2*" MinHeight="80" />
|
|
<RowDefinition Height="Auto" />
|
|
</Grid.RowDefinitions>
|
|
|
|
<Border
|
|
Grid.Row="0"
|
|
Padding="6,4"
|
|
Background="#F5F5F5"
|
|
BorderBrush="{StaticResource PanelBorder}"
|
|
BorderThickness="0,1,0,1">
|
|
<StackPanel HorizontalAlignment="Left" Orientation="Horizontal">
|
|
<Button
|
|
Command="{Binding NewPipelineCommand}"
|
|
Content="新建"
|
|
Style="{StaticResource ToolbarBtn}"
|
|
ToolTip="新建流水线" />
|
|
<Button
|
|
Command="{Binding SavePipelineCommand}"
|
|
Content="保存"
|
|
Style="{StaticResource ToolbarBtn}"
|
|
ToolTip="保存当前流水线" />
|
|
<Button
|
|
Width="60"
|
|
Command="{Binding SaveAsPipelineCommand}"
|
|
Content="另存为"
|
|
Style="{StaticResource ToolbarBtn}"
|
|
ToolTip="另存当前流水线" />
|
|
<Button
|
|
Width="52"
|
|
Command="{Binding LoadPipelineCommand}"
|
|
Content="加载"
|
|
Style="{StaticResource ToolbarBtn}"
|
|
ToolTip="加载流水线" />
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<ListBox
|
|
x:Name="PipelineListBox"
|
|
Grid.Row="1"
|
|
Background="Transparent"
|
|
BorderThickness="0"
|
|
ItemContainerStyle="{StaticResource PipelineNodeItemStyle}"
|
|
ItemsSource="{Binding PipelineNodes}"
|
|
KeyboardNavigation.TabNavigation="Continue"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
SelectedItem="{Binding SelectedNode, Mode=TwoWay}">
|
|
<ListBox.ItemTemplate>
|
|
<DataTemplate>
|
|
<Border
|
|
x:Name="NodeContainer"
|
|
Margin="2"
|
|
Padding="2"
|
|
Background="Transparent"
|
|
BorderBrush="Transparent"
|
|
BorderThickness="1"
|
|
CornerRadius="3">
|
|
<Grid x:Name="NodeRoot" MinHeight="48">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="44" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<Line
|
|
x:Name="TopLine"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Top"
|
|
Stroke="#5B9BD5"
|
|
StrokeThickness="2"
|
|
X1="0"
|
|
X2="0"
|
|
Y1="0"
|
|
Y2="10" />
|
|
<Line
|
|
x:Name="BottomLine"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Bottom"
|
|
Stroke="#5B9BD5"
|
|
StrokeThickness="2"
|
|
X1="0"
|
|
X2="0"
|
|
Y1="0"
|
|
Y2="14" />
|
|
|
|
<Border
|
|
x:Name="IconBorder"
|
|
Grid.Column="0"
|
|
Width="28"
|
|
Height="28"
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
Background="#E8F0FE"
|
|
BorderBrush="#5B9BD5"
|
|
BorderThickness="1.5"
|
|
CornerRadius="4">
|
|
<TextBlock
|
|
HorizontalAlignment="Center"
|
|
VerticalAlignment="Center"
|
|
FontSize="13"
|
|
Text="{Binding IconPath}" />
|
|
</Border>
|
|
|
|
<StackPanel Grid.Column="1" Margin="6,0,0,0" VerticalAlignment="Center">
|
|
<TextBlock
|
|
x:Name="NodeTitle"
|
|
FontFamily="Microsoft YaHei UI"
|
|
FontSize="12"
|
|
Text="{Binding DisplayName}" />
|
|
<TextBlock
|
|
x:Name="NodeState"
|
|
Margin="0,2,0,0"
|
|
FontFamily="Microsoft YaHei UI"
|
|
FontSize="10"
|
|
Foreground="#6E6E6E"
|
|
Text="已启用" />
|
|
</StackPanel>
|
|
</Grid>
|
|
</Border>
|
|
<DataTemplate.Triggers>
|
|
<DataTrigger Binding="{Binding Order}" Value="0">
|
|
<Setter TargetName="TopLine" Property="Visibility" Value="Collapsed" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding IsEnabled}" Value="False">
|
|
<Setter TargetName="NodeContainer" Property="Background" Value="{StaticResource DisabledNodeBg}" />
|
|
<Setter TargetName="NodeContainer" Property="Opacity" Value="0.78" />
|
|
<Setter TargetName="TopLine" Property="Stroke" Value="{StaticResource DisabledNodeLine}" />
|
|
<Setter TargetName="BottomLine" Property="Stroke" Value="{StaticResource DisabledNodeLine}" />
|
|
<Setter TargetName="IconBorder" Property="BorderBrush" Value="{StaticResource DisabledNodeLine}" />
|
|
<Setter TargetName="IconBorder" Property="Background" Value="#ECECEC" />
|
|
<Setter TargetName="NodeTitle" Property="Foreground" Value="{StaticResource DisabledNodeText}" />
|
|
<Setter TargetName="NodeState" Property="Text" Value="已停用" />
|
|
<Setter TargetName="NodeState" Property="Foreground" Value="#9A6767" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem}, Path=IsSelected}" Value="True">
|
|
<Setter TargetName="NodeContainer" Property="Background" Value="#D9ECFF" />
|
|
<Setter TargetName="NodeContainer" Property="BorderBrush" Value="#5B9BD5" />
|
|
</DataTrigger>
|
|
<MultiDataTrigger>
|
|
<MultiDataTrigger.Conditions>
|
|
<Condition Binding="{Binding IsEnabled}" Value="False" />
|
|
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem}, Path=IsSelected}" Value="True" />
|
|
</MultiDataTrigger.Conditions>
|
|
<Setter TargetName="NodeContainer" Property="Background" Value="#E6EEF7" />
|
|
<Setter TargetName="NodeContainer" Property="BorderBrush" Value="#7E9AB6" />
|
|
<Setter TargetName="NodeContainer" Property="Opacity" Value="1" />
|
|
</MultiDataTrigger>
|
|
</DataTemplate.Triggers>
|
|
</DataTemplate>
|
|
</ListBox.ItemTemplate>
|
|
</ListBox>
|
|
|
|
<Rectangle
|
|
Grid.Row="2"
|
|
Height="1"
|
|
Fill="{StaticResource SeparatorBrush}" />
|
|
|
|
<ScrollViewer
|
|
Grid.Row="3"
|
|
HorizontalScrollBarVisibility="Disabled"
|
|
VerticalScrollBarVisibility="Auto">
|
|
<StackPanel Margin="8,6">
|
|
<TextBlock
|
|
Margin="0,0,0,4"
|
|
FontFamily="{StaticResource CsdFont}"
|
|
FontSize="11"
|
|
FontWeight="Bold"
|
|
Foreground="#555"
|
|
Text="参数配置" />
|
|
<ItemsControl ItemsSource="{Binding SelectedNode.Parameters}">
|
|
<ItemsControl.ItemContainerStyle>
|
|
<Style TargetType="ContentPresenter">
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsVisible}" Value="False">
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ItemsControl.ItemContainerStyle>
|
|
<ItemsControl.ItemTemplate>
|
|
<DataTemplate>
|
|
<Grid Margin="0,3">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="100" />
|
|
<ColumnDefinition Width="*" />
|
|
</Grid.ColumnDefinitions>
|
|
<TextBlock
|
|
Grid.Column="0"
|
|
VerticalAlignment="Center"
|
|
FontFamily="Microsoft YaHei UI"
|
|
FontSize="11"
|
|
Text="{Binding DisplayName}"
|
|
TextTrimming="CharacterEllipsis" />
|
|
<TextBox
|
|
x:Name="TextValueEditor"
|
|
Grid.Column="1"
|
|
Padding="4,2"
|
|
BorderBrush="#CDCBCB"
|
|
BorderThickness="1"
|
|
FontFamily="Microsoft YaHei UI"
|
|
FontSize="11"
|
|
Text="{Binding Value, UpdateSourceTrigger=PropertyChanged}">
|
|
<TextBox.Style>
|
|
<Style TargetType="TextBox">
|
|
<Setter Property="BorderBrush" Value="#CDCBCB" />
|
|
<Setter Property="Background" Value="White" />
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsTextInput}" Value="False">
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
</DataTrigger>
|
|
<DataTrigger Binding="{Binding IsValueValid}" Value="False">
|
|
<Setter Property="BorderBrush" Value="Red" />
|
|
<Setter Property="Background" Value="#FFF0F0" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBox.Style>
|
|
</TextBox>
|
|
<ComboBox
|
|
Grid.Column="1"
|
|
MinHeight="24"
|
|
Padding="4,1"
|
|
BorderBrush="#CDCBCB"
|
|
BorderThickness="1"
|
|
FontFamily="Microsoft YaHei UI"
|
|
FontSize="11"
|
|
ItemsSource="{Binding Options}"
|
|
SelectedItem="{Binding SelectedOption, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
|
<ComboBox.Style>
|
|
<Style TargetType="ComboBox">
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding HasOptions}" Value="True">
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</ComboBox.Style>
|
|
</ComboBox>
|
|
<CheckBox
|
|
Grid.Column="1"
|
|
VerticalAlignment="Center"
|
|
FontFamily="Microsoft YaHei UI"
|
|
FontSize="11"
|
|
IsChecked="{Binding BoolValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
|
<CheckBox.Style>
|
|
<Style TargetType="CheckBox">
|
|
<Setter Property="Visibility" Value="Collapsed" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsBool}" Value="True">
|
|
<Setter Property="Visibility" Value="Visible" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</CheckBox.Style>
|
|
</CheckBox>
|
|
</Grid>
|
|
</DataTemplate>
|
|
</ItemsControl.ItemTemplate>
|
|
</ItemsControl>
|
|
</StackPanel>
|
|
</ScrollViewer>
|
|
|
|
<Border
|
|
Grid.Row="4"
|
|
Padding="6,4"
|
|
BorderThickness="0,1,0,0">
|
|
<Border.Style>
|
|
<Style TargetType="Border">
|
|
<Setter Property="Background" Value="#F5F5F5" />
|
|
<Setter Property="BorderBrush" Value="{StaticResource PanelBorder}" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsStatusError}" Value="True">
|
|
<Setter Property="Background" Value="#FFF1F1" />
|
|
<Setter Property="BorderBrush" Value="#D9534F" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</Border.Style>
|
|
<TextBlock
|
|
FontFamily="{StaticResource CsdFont}"
|
|
FontSize="11"
|
|
Text="{Binding StatusMessage, StringFormat='Status: {0}'}"
|
|
TextTrimming="CharacterEllipsis">
|
|
<TextBlock.Style>
|
|
<Style TargetType="TextBlock">
|
|
<Setter Property="Foreground" Value="#555" />
|
|
<Style.Triggers>
|
|
<DataTrigger Binding="{Binding IsStatusError}" Value="True">
|
|
<Setter Property="Foreground" Value="#A12A2A" />
|
|
</DataTrigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
</TextBlock.Style>
|
|
</TextBlock>
|
|
</Border>
|
|
</Grid>
|
|
</Border>
|
|
</UserControl>
|