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.

232 lines
17 KiB

<UserControl x:Class="Gumming.DispenseView"
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:StepTextConverter x:Key="StepBrushConverter"/>
<DataTemplate x:Key="PortFieldMapping">
<Border Name="ItemBorder" Height="30" BorderThickness="0" BorderBrush="Black">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="200"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Border BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}" >
<TextBlock Text="{Binding StepName}" 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}">
<Grid>
<Border>
<Border.Background>
<MultiBinding Converter="{StaticResource StepBrushConverter}">
<Binding Path="SelecedMode.Tag" />
<Binding Path="Copy.Mode" />
</MultiBinding>
</Border.Background>
</Border>
<ComboBox BorderThickness="0" ItemsSource="{Binding Path=Modes}" SelectedItem="{Binding SelecedMode, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding ComboCode, Mode=TwoWay}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</Grid>
</Border>
<Border Grid.Column="2" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<local:FloatBox MaxValue="10000" Style="{DynamicResource ListViewTextBoxStyle}" Text="{Binding IntervalTime, Mode=TwoWay,UpdateSourceTrigger=LostFocus,StringFormat=F1}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center" FontSize="14" >
<TextBox.Background>
<MultiBinding Converter="{StaticResource StepBrushConverter}">
<Binding Path="IntervalTime" />
<Binding Path="Copy.IntervalTime" />
</MultiBinding>
</TextBox.Background>
</local:FloatBox>
</Border>
<Border Grid.Column="3" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<local:IntBox MaxValue="1000" Style="{DynamicResource ListViewTextBoxStyle}" Text="{Binding DispenseCount, Mode=TwoWay,UpdateSourceTrigger=LostFocus,StringFormat=F0}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center" FontSize="14" >
<TextBox.Background>
<MultiBinding Converter="{StaticResource StepBrushConverter}">
<Binding Path="DispenseCount" />
<Binding Path="Copy.DispenseCount" />
</MultiBinding>
</TextBox.Background>
</local:IntBox>
</Border>
<Border Grid.Column="4" BorderThickness="1,0,0,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<local:FloatBox MaxValue="1000" Style="{DynamicResource ListViewTextBoxStyle}" Text="{Binding DispenseInterval, Mode=TwoWay,UpdateSourceTrigger=LostFocus,StringFormat=F1}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center" FontSize="14" >
<TextBox.Background>
<MultiBinding Converter="{StaticResource StepBrushConverter}">
<Binding Path="DispenseInterval" />
<Binding Path="Copy.DispenseInterval" />
</MultiBinding>
</TextBox.Background>
</local:FloatBox>
</Border>
<Border Grid.Column="5" BorderThickness="1,0,1,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<local:FloatBox MaxValue="1000" Style="{DynamicResource ListViewTextBoxStyle}" Text="{Binding DispenseInterval, Mode=TwoWay,UpdateSourceTrigger=LostFocus,StringFormat=F1}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center" FontSize="14" >
<TextBox.Background>
<MultiBinding Converter="{StaticResource StepBrushConverter}">
<Binding Path="DispenseInterval" />
<Binding Path="Copy.DispenseInterval" />
</MultiBinding>
</TextBox.Background>
</local:FloatBox>
</Border>
<!--<Border Grid.Column="5" BorderThickness="1,0,1,1" BorderBrush="{DynamicResource BaseBrushBorder}">
<local:FloatBox MaxValue="18000" Style="{DynamicResource ListViewTextBoxStyle}" Text="{Binding DispenseTime, Mode=TwoWay,UpdateSourceTrigger=LostFocus,StringFormat=F1}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Center" FontSize="14" >
<TextBox.Background>
<MultiBinding Converter="{StaticResource StepBrushConverter}">
<Binding Path="DispenseTime" />
<Binding Path="Copy.DispenseTime" />
</MultiBinding>
</TextBox.Background>
</local:FloatBox>
</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="160"></ColumnDefinition>
<ColumnDefinition Width="10"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<ListBox Grid.Column="0" tool:TouchScrolling.IsEnabled="True" ScrollViewer.HorizontalScrollBarVisibility="Disabled" PreviewKeyDown="listBox_PreviewKeyDown" x:Name="LstFormula" Background="Transparent" BorderBrush="{DynamicResource DefaultBorderBrush}" BorderThickness="1" ItemsSource="{Binding StationCodes}" SelectedItem="{Binding SelectedStationCode, Mode=TwoWay}" ItemContainerStyle="{DynamicResource PatternListBoxItem}" Height="500" VerticalAlignment="Top">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock TextAlignment="Left" VerticalAlignment="Center" Text="{Binding ComboName}" TextTrimming="CharacterEllipsis">
<TextBlock.ToolTip>
<TextBlock Text="{Binding ComboName}"></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.Column="2">
<Grid.RowDefinitions>
<RowDefinition Height="0"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="5"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid Grid.Row="1" Grid.Column="0" >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="100"></ColumnDefinition>
<ColumnDefinition Width="120"></ColumnDefinition>
<ColumnDefinition Width="200"></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="模式" 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="间隔时间[S]" 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="喷洒次数" 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="喷洒间隔时间[s]" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<Border Grid.Column="5" BorderThickness="1,1,1,1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="喷洒时间[S]" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>
<!--<Border Grid.Column="5" BorderThickness="1" BorderBrush="{DynamicResource BaseBrushBorder}" Background="Transparent" >
<TextBlock Text="喷洒量[P/S]" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" FontSize="12" Foreground="{DynamicResource FontBrush1}" ></TextBlock>
</Border>-->
</Grid>
<ListView Grid.Row="2" x:Name="FieldMappingView" tool:TouchScrolling.IsEnabled="True" ItemTemplate="{DynamicResource PortFieldMapping}" ItemsSource="{Binding Dispenses}"
Template="{DynamicResource ListViewItemMapping}" ItemContainerStyle="{DynamicResource ListViewItemContainerStyle}" BorderThickness="0" IsHitTestVisible="True"
SelectedItem="{Binding SelectedDispense, Mode=TwoWay}" SelectionMode="Extended" Foreground="{DynamicResource FontBrush4}" IsEnabled="{Binding AllowEdit}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<tool:ExecuteCommandAction Command="{Binding SelectStepCommand}" CommandParameter="{Binding SelectedItems, ElementName=FieldMappingView}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</ListView>
<Grid Grid.Row="0" 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="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<TextBlock Text="流片名称:" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="14"></TextBlock>
<TextBox Grid.Column="2" Text="{Binding StationCode}" IsEnabled="{Binding AllowEdit}" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="14"></TextBox>
<TextBlock Grid.Column="4" Text="创建人:" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="14"></TextBlock>
<TextBox Grid.Column="6" IsEnabled="False" Text="{Binding CreateBy}" HorizontalAlignment="Stretch" VerticalAlignment="Center" FontSize="14"></TextBox>
</Grid>
<Grid Grid.Row="5" 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" Style="{DynamicResource CommonIconButton}" Command="{Binding AllowCommand}" Content="编辑"></Button>
<Button Grid.Column="2" Margin="2" FontSize="15" IsEnabled="{Binding AllowEdit}" Style="{DynamicResource CommonIconButton}" Command="{Binding DisabledCommand}" Content="取消编辑"></Button>
<Button Grid.Column="4" Margin="2" FontSize="15" IsEnabled="{Binding AllowEdit}" Style="{DynamicResource CommonIconButton}" Command="{Binding SaveStepCommand}" Content="保存"></Button>
</Grid>
</Grid>
</Grid>
</UserControl>