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.

258 lines
22 KiB

<UserControl x:Class="Gumming.UnitView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:local="clr-namespace:Gumming"
xmlns:tool="clr-namespace:GummingCommon;assembly=GummingCommon"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
d:DesignHeight="700" d:DesignWidth="1000"
Background="Transparent"
x:Name="rootControl">
<UserControl.Resources>
<tool:RadioButtonConverter x:Key="RadioConverter"/>
<tool:BooleanToOpacityConverter x:Key="OpacityConverter"/>
<tool:EditorTextConverter x:Key="TextBrushConverter"/>
<tool:EditorBorderConverter x:Key="BorderBrushConverter"/>
<tool:PathTypeToThemeConverter x:Key="PathTypeConverter"/>
<tool:StepStyleConverter x:Key="StepStyleConverter"/>
<tool:ListViewDisabledStyleConverter x:Key="ListViewDisabledStyleConverter"/>
<DataTemplate x:Key="PortFieldMapping">
<Border Name="ItemBorder" Height="30" BorderThickness="0" BorderBrush="Black">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" >
<TextBlock Text="{Binding StepIndex}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="1" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<Button Style="{DynamicResource ListViewButton}" Tag="{Binding Unit1Tag}" Content="{Binding Unit1Tag.FormulaText}" ToolTip="{Binding Unit1Tag.FormulaText}" CommandParameter="{Binding Unit1Tag}" Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}},Path=DataContext.UnitClickCommand}"></Button>
</Border>
<Border Grid.Column="2" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<Button Style="{DynamicResource ListViewButton}" Tag="{Binding Unit2Tag}" Content="{Binding Unit2Tag.FormulaText}" ToolTip="{Binding Unit2Tag.FormulaText}" CommandParameter="{Binding Unit2Tag}" Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}},Path=DataContext.UnitClickCommand}"></Button>
</Border>
<Border Grid.Column="3" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<Button Style="{DynamicResource ListViewButton}" Tag="{Binding Unit3Tag}" Content="{Binding Unit3Tag.FormulaText}" ToolTip="{Binding Unit3Tag.FormulaText}" CommandParameter="{Binding Unit3Tag}" Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}},Path=DataContext.UnitClickCommand}"></Button>
</Border>
<Border Grid.Column="4" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<Button Style="{DynamicResource ListViewButton}" Tag="{Binding Unit4Tag}" Content="{Binding Unit4Tag.FormulaText}" ToolTip="{Binding Unit4Tag.FormulaText}" CommandParameter="{Binding Unit4Tag}" Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}},Path=DataContext.UnitClickCommand}"></Button>
</Border>
<Border Grid.Column="5" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<Button Style="{DynamicResource ListViewButton}" Tag="{Binding Unit5Tag}" Content="{Binding Unit5Tag.FormulaText}" ToolTip="{Binding Unit5Tag.FormulaText}" CommandParameter="{Binding Unit5Tag}" Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}},Path=DataContext.UnitClickCommand}"></Button>
</Border>
<Border Grid.Column="6" BorderThickness="1,0,1,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<Button Style="{DynamicResource ListViewButton}" Tag="{Binding Unit6Tag}" Content="{Binding Unit6Tag.FormulaText}" ToolTip="{Binding Unit6Tag.FormulaText}" CommandParameter="{Binding Unit6Tag}" Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}},Path=DataContext.UnitClickCommand}"></Button>
</Border>
<!--<Border Grid.Column="7" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<Button Style="{DynamicResource ListViewButton}" Tag="{Binding Unit7Tag}" Content="{Binding Unit7Tag.FormulaText}" ToolTip="{Binding Unit7Tag.FormulaText}" CommandParameter="{Binding Unit7Tag}" Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}},Path=DataContext.UnitClickCommand}"></Button>
</Border>
<Border Grid.Column="8" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<Button Style="{DynamicResource ListViewButton}" Tag="{Binding Unit8Tag}" Content="{Binding Unit8Tag.FormulaText}" ToolTip="{Binding Unit8Tag.FormulaText}" CommandParameter="{Binding Unit8Tag}" Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}},Path=DataContext.UnitClickCommand}"></Button>
</Border>
<Border Grid.Column="9" BorderThickness="1,0,1,1" BorderBrush="{DynamicResource BaseBrushBorder}" >
<Button Style="{DynamicResource ListViewButton}" Tag="{Binding Unit9Tag}" Content="{Binding Unit9Tag.FormulaText}" ToolTip="{Binding Unit9Tag.FormulaText}" CommandParameter="{Binding Unit9Tag}" Command="{Binding RelativeSource={RelativeSource FindAncestor,AncestorType={x:Type UserControl}},Path=DataContext.UnitClickCommand}"></Button>
</Border>-->
</Grid>
</Border>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType={x:Type ListViewItem}}, Path=IsSelected}" Value="True">
<Setter TargetName="ItemBorder" Property="Background" Value="#DDD"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
</UserControl.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="200"></ColumnDefinition>
<ColumnDefinition Width="10"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="5"></RowDefinition>
<RowDefinition Height="70"></RowDefinition>
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<ListBox tool:TouchScrolling.IsEnabled="True" ScrollViewer.HorizontalScrollBarVisibility="Disabled" PreviewKeyDown="listBox_PreviewKeyDown" x:Name="LstFormula" Background="Transparent" BorderBrush="{DynamicResource DefaultBorderBrush}" BorderThickness="1" ItemsSource="{Binding HardFlows}" SelectedItem="{Binding SelectedFlow, Mode=TwoWay}" ItemContainerStyle="{DynamicResource PatternListBoxItem}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock TextAlignment="Left" VerticalAlignment="Center" Text="{Binding FlowName}" TextTrimming="CharacterEllipsis">
<TextBlock.ToolTip>
<TextBlock Text="{Binding FlowName}"></TextBlock>
</TextBlock.ToolTip>
</TextBlock>
</DataTemplate>
</ListBox.ItemTemplate>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<tool:ExecuteCommandAction Command="{Binding SelectFlowCommand}" CommandParameter="{Binding SelectedItem,ElementName=LstFormula}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ListBox>
</Grid>
<Grid Grid.Row="2">
<Grid.RowDefinitions>
<RowDefinition Height="31"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="31"></RowDefinition>
<RowDefinition Height="0"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="5"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="5"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Margin="2" FontSize="15" Style="{DynamicResource CommonIconButton}" Command="{Binding NewCommand}" Content="新增"></Button>
<Button Grid.Column="2" Margin="2" FontSize="15" Style="{DynamicResource CommonIconButton}" Command="{Binding AllowCommand}" Content="编辑"></Button>
<Button Grid.Column="4" Margin="2" FontSize="15" IsEnabled="{Binding AllowEdit}" Style="{DynamicResource CommonIconButton}" Command="{Binding DisabledCommand}" Content="取消"></Button>
<Button Grid.Row="2" Grid.Column="0" Margin="2" FontSize="15" IsEnabled="{Binding AllowEdit}" Style="{DynamicResource CommonIconButton}" Command="{Binding SaveStepCommand}" Content="保存"></Button>
<Button Grid.Row="2" Grid.Column="2" Margin="2" FontSize="15" Style="{DynamicResource CommonIconButton}" Command="{Binding SaveAsFormulaCommand}" Content="另存"></Button>
<Button Grid.Row="2" Grid.Column="4" Margin="2" FontSize="15" Style="{DynamicResource CommonIconButton}" Command="{Binding DeleteFormulaCommand}" Content="删除"></Button>
</Grid>
</Grid>
<Grid Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="5"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="5"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<ScrollViewer Grid.Row="2" VerticalScrollBarVisibility="Auto" HorizontalScrollBarVisibility="Auto">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="步骤" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="1" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="Unit1" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="2" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="Unit2" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="3" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="Unit3" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="4" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="Unit4" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="5" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="Unit5" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="6" BorderThickness="1,1,1,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="Unit6" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<!--<Border Grid.Column="7" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="Unit7" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="8" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="Unit8" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="9" BorderThickness="1,1,1,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="Unit9" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>-->
</Grid>
<ListView Grid.Row="1" x:Name="FieldMappingView" tool:TouchScrolling.IsEnabled="True" ItemTemplate="{DynamicResource PortFieldMapping}" ItemsSource="{Binding HardUnits}"
Template="{DynamicResource ListViewItemMapping}" ItemContainerStyle="{Binding Path=AllowEdit,Converter={StaticResource ListViewDisabledStyleConverter}}" BorderThickness="0" IsHitTestVisible="True"
SelectedItem="{Binding SelectedStep, Mode=TwoWay}" SelectionMode="Extended" Foreground="{DynamicResource FontBrush4}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<tool:ExecuteCommandAction Command="{Binding SelectStepCommand}" CommandParameter="{Binding SelectedItems, ElementName=FieldMappingView}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ListView>
</Grid>
</ScrollViewer>
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="220"></ColumnDefinition>
<ColumnDefinition Width="140"></ColumnDefinition>
<ColumnDefinition Width="230"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border Grid.Column="0" BorderThickness="1,1,0,1" BorderBrush="{DynamicResource DefaultBorderBrush}" Background="Transparent" >
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="8"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="流片名称:" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="14"></TextBlock>
<TextBox Grid.Column="3" Text="{Binding FlowName}" IsEnabled="{Binding AllowEdit}" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="14"></TextBox>
</Grid>
</Border>
<Border Grid.Column="1" BorderThickness="1,1,1,1" BorderBrush="{DynamicResource DefaultBorderBrush}" Background="Transparent" >
<Grid Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="8"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="1" Text="创建人:" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="14"></TextBlock>
<TextBox Grid.Column="3" IsEnabled="False" Text="{Binding CreateBy}" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="14"></TextBox>
</Grid>
</Border>
</Grid>
<Grid Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="3"></ColumnDefinition>
<ColumnDefinition Width="80"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Margin="2" FontSize="15" IsEnabled="{Binding AllowEdit}" Style="{DynamicResource CommonIconButton}" Command="{Binding InsertStepCommand}" Content="插入步骤"></Button>
<Button Grid.Column="2" Margin="2" FontSize="15" IsEnabled="{Binding AllowEdit}" Style="{DynamicResource CommonIconButton}" Command="{Binding AddStepCommand}" Content="添加步骤"></Button>
<Button Grid.Column="4" Margin="2" FontSize="15" IsEnabled="{Binding AllowEdit}" Style="{DynamicResource CommonIconButton}" Command="{Binding DeleteStepCommand}" Content="删除步骤"></Button>
<Button Grid.Column="6" Margin="2" FontSize="15" IsEnabled="{Binding AllowEdit}" Style="{DynamicResource CommonIconButton}" Command="{Binding CopyStepCommand}" Content="复制步骤"></Button>
</Grid>
</Grid>
</Grid>
</UserControl>