<Page x:Class="FLY.Weight.UI.Client.PgHopper"
      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" 
      xmlns:local="clr-namespace:FLY.Weight.UI.Client"
      mc:Ignorable="d" 
      d:DesignHeight="900" d:DesignWidth="960" Background="White"
      Unloaded="Page_Unloaded"
      Title="Page_Hopper">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Converter/Dictionary_MyConv.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/FLY.Weight.UI.Client;component/Themes/ABCTab.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/FLY.Weight.UI.Client;component/UnitTests/UnitTests_Weights.xaml"/>
            </ResourceDictionary.MergedDictionaries>

            <Style x:Key="TabItemStyle_ABC2" TargetType="{x:Type TabItem}">
                <Setter Property="Foreground" Value="Black"/>

                <Setter Property="Margin" Value="0"/>
                <Setter Property="Padding" Value="6,2,6,2"/>
                <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                <Setter Property="VerticalContentAlignment" Value="Stretch"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type TabItem}" >
                            <Grid x:Name="templateRoot" SnapsToDevicePixels="true" Margin="10,0">
                                <Border x:Name="mainBorder" Width="115" Height="100" Background="{Binding Color}" Margin="0" />
                                <TextBlock Text="{Binding Number}" Width="100" Height="100" FontSize="100" Foreground="White" FontFamily="Arial Black" FontWeight="Bold"  VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="-20,0,0,0" >
                                    <TextBlock.Clip>
                                        <RectangleGeometry Rect="20,0,80,100"/>
                                    </TextBlock.Clip>
                                </TextBlock>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <MultiDataTrigger>
                                    <MultiDataTrigger.Conditions>
                                        <Condition Binding="{Binding IsSelected, RelativeSource={RelativeSource Self}}" Value="true"/>
                                    </MultiDataTrigger.Conditions>
                                    <Setter Property="Panel.ZIndex" Value="2"/>
                                    <Setter Property="Margin" Value="-2,-2,-2,-2"/>
                                    <Setter Property="Margin" TargetName="mainBorder" Value="-1"/>
                                </MultiDataTrigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </Page.Resources>
    <Grid Name="root_grid" d:DataContext="{StaticResource unittests_weighters}">

        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="496*" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Background="{StaticResource Background_Title}">
            <Button Style="{StaticResource ButtonStyle_back2}" Click="button_back_Click" />
            <TextBlock Style="{StaticResource TextBlockStyle_Title}"  Text="基本参数设置"/>
        </StackPanel>
        <TabControl Grid.Row="1" ItemsSource="{Binding Items}" Style="{StaticResource TabControlStyle_ABC}" SelectedIndex="2">
            <TabControl.ItemContainerStyle>
                <Style TargetType="TabItem" BasedOn="{StaticResource TabItemStyle_ABC2}">
                    <Setter Property="ContentTemplate">
                        <Setter.Value>
                            <DataTemplate>
                                <ScrollViewer CanContentScroll="True" PanningMode="Both" >
                                    <StackPanel >
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="auto" />
                                                <ColumnDefinition  />
                                            </Grid.ColumnDefinitions>

                                            <Border Style="{StaticResource BorderStyle_paramSection}"  Background="{Binding Color}">
                                                <TextBlock Text="时间" />
                                            </Border>
                                            <WrapPanel Orientation="Horizontal" Grid.Column="1">
                                                
                                                <StackPanel Margin="{StaticResource ControlMargin}" Visibility="{Binding IsSingle,Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="卸料时间" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding UnloadingTime,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="s" />
                                                    </StackPanel>
                                                </StackPanel>
                                                <StackPanel  Margin="{StaticResource ControlMargin}" Visibility="{Binding IsSingle,Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="零位稳定" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding ZeroStableTime,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="s" />
                                                    </StackPanel>
                                                </StackPanel>
                                                <StackPanel  Margin="{StaticResource ControlMargin}" Visibility="{Binding IsSingle,Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="流量切换" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding FlowSwitchEnable,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="s" />
                                                    </StackPanel>
                                                </StackPanel>
                                                <StackPanel  Margin="{StaticResource ControlMargin}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="取样时间" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding SampleTimeSet,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="s" />
                                                    </StackPanel>
                                                </StackPanel>

                                                <StackPanel  Margin="{StaticResource ControlMargin}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="重量稳定" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding WeightStableTime,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="s" />
                                                    </StackPanel>
                                                </StackPanel>
                                                <StackPanel  Margin="{StaticResource ControlMargin}" Visibility="{Binding IsSingle,Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="搅拌时间" Foreground="{Binding Color}" />
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding MixingTimeSet,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="s" />
                                                    </StackPanel>
                                                </StackPanel>
                                                <StackPanel  Margin="{StaticResource ControlMargin}" Visibility="{Binding IsSingle,Converter={StaticResource visbilityconv}}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="料阀异常" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding ValveErrSet,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="s" />
                                                    </StackPanel>
                                                </StackPanel>
                                            </WrapPanel >

                                        </Grid>
                                        <Grid>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="auto" />
                                                <ColumnDefinition  />
                                            </Grid.ColumnDefinitions>

                                            <Border Width="150" Background="{Binding Color}" Margin="0,5,5,5" >
                                                <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="其它" />
                                            </Border>
                                            <WrapPanel Orientation="Horizontal" Grid.Column="1">
                                                <StackPanel  Margin="{StaticResource ControlMargin}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="料斗基准重量" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding MixSet,StringFormat={}{0:F3}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="kg" />
                                                    </StackPanel>
                                                </StackPanel>


                                                <StackPanel  Margin="{StaticResource ControlMargin}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="额定频率" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding ScrewMotorRatedFreq,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="Hz" />
                                                    </StackPanel>
                                                </StackPanel>
                                                <StackPanel  Margin="{StaticResource ControlMargin}" Visibility="{Binding IsSingle,Converter={StaticResource visbilityconv}}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="料位上限" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding MaterialUpperLimitSet,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="kg" />
                                                    </StackPanel>
                                                </StackPanel>
                                                <StackPanel  Margin="{StaticResource ControlMargin}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="料位下限" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding MaterialLowLimitSet,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="kg" />
                                                    </StackPanel>
                                                </StackPanel>
                                                
                                                <StackPanel  Margin="{StaticResource ControlMargin}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="报警偏差" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding AlarmDeviationSet,StringFormat={}{0:F0}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="%" />
                                                    </StackPanel>
                                                </StackPanel>
                                                <StackPanel  Margin="{StaticResource ControlMargin}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="重量校正系数" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding WeightCorrectFactor,StringFormat={}{0:F2}}"/>
 
                                                    </StackPanel>
                                                </StackPanel>
                                                <StackPanel  Margin="{StaticResource ControlMargin}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="缺料报警" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding LackErrorSet,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="kg" />
                                                    </StackPanel>
                                                </StackPanel>
                                                <StackPanel  Margin="{StaticResource ControlMargin}" Visibility="{Binding IsSingle,Converter={StaticResource visbilityconv}}">
                                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="料仓缺料" Foreground="{Binding Color}"/>
                                                    <StackPanel Orientation="Horizontal">
                                                        <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding BinLackErrorSet,StringFormat={}{0:F1}}"/>
                                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="kg" />
                                                    </StackPanel>
                                                </StackPanel>

                                            </WrapPanel >

                                        </Grid>

                                    </StackPanel>
                                </ScrollViewer>
                            </DataTemplate>
                        </Setter.Value>
                    </Setter>

                </Style>
            </TabControl.ItemContainerStyle>
        </TabControl>
    </Grid>
</Page>