<UserControl x:Class="FLY.FilmCasting.AutoDie.UI.Client.UcThickHeat"
             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:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" 
             xmlns:iconPacks="http://metro.mahapps.com/winfx/xaml/iconpacks"
             xmlns:local="clr-namespace:FLY.FilmCasting.AutoDie.UI.Client" xmlns:lvc1="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Feng.Wpf"
             mc:Ignorable="d" d:DesignWidth="1024">
    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/FLY.Thick.Base.UI;component/Converter/Dictionary_MyConv.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/FLY.FilmCasting.AutoDie.UI.Client;component/Themes/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <SolidColorBrush x:Key="TextBrush" Color="#4C4949" />
            <SolidColorBrush x:Key="SemiTransparentGreyBrush" Color="#99F0F0F0"/>
            <SolidColorBrush x:Key="WhiteBrush" Color="White"/>
            <local:UcThickHeatVmUt x:Key="viewModel" IsStable="False" IsVaild="True"/>
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid d:DataContext="{StaticResource viewModel}">
        <Border Style="{StaticResource Styles.Card.Border}" >
            <StackPanel>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="auto"/>
                        <RowDefinition/>
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition Width="460*"/>
                        <ColumnDefinition Width="220*"/>
                    </Grid.ColumnDefinitions>

                    <lvc:CartesianChart  Grid.Row="1" Grid.ColumnSpan="3" Height="150"  Margin="5,2,2,2"
                                    DisableAnimations="True" Hoverable="False" DataTooltip="{x:Null}"  >
                        <lvc:CartesianChart.Series>
                            <lvc1:Column2Series 
                                PointGeometry="{x:Null}"
                                StrokeThickness ="1"
                                Stroke="Black"
                                Fill="{StaticResource Brushes.PreHeat}"
                                Values="{Binding Heats}"
                                Configuration="{Binding MapperHeats}"/>
                            <lvc:LineSeries 
                                PointGeometry="{x:Null}"
                                StrokeThickness ="3"
                                Stroke="{StaticResource Brushes.Thick}"
                                Fill="Transparent"
                                Values="{Binding ThickPercents}"
                                Configuration="{Binding MapperThickPercents}"/>
                        </lvc:CartesianChart.Series>
                        <lvc:CartesianChart.AxisX>
                            <lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
                                      MinValue="0" MaxValue="{Binding XMax}">
                                <lvc:Axis.Separator>
                                    <lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="5"/>
                                </lvc:Axis.Separator>
                            </lvc:Axis>
                        </lvc:CartesianChart.AxisX>
                        <lvc:CartesianChart.AxisY>
                            <lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}"
                                      LabelFormatter="{Binding YFormatter}" FontFamily="Courier New" 
                                      MinValue="0" MaxValue="100">
                                <lvc:Axis.Separator>
                                    <lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="10"/>
                                </lvc:Axis.Separator>
                            </lvc:Axis>
                        </lvc:CartesianChart.AxisY>
                    </lvc:CartesianChart>
                    <StackPanel Orientation="Horizontal" Margin="48,0,0,-20" Opacity="0.8">
                        
                        <Button Style="{StaticResource Styles.Button.Icon.Rectangle}" Command="{Binding PreStableCmd}" >
                            <iconPacks:PackIconMaterial Kind="ChevronDoubleLeft" />
                        </Button>
                        <Button Style="{StaticResource Styles.Button.Icon.Rectangle}" Command="{Binding PreCmd}" >
                            <iconPacks:PackIconMaterial Kind="ChevronLeft" Width="10"/>
                        </Button>
                        <Button Style="{StaticResource Styles.Button.Icon.Rectangle}" Command="{Binding NextCmd}">
                            <!--<iconPacks:PackIconMaterial Kind="ArrowRight" />-->
                            <iconPacks:PackIconMaterial Kind="ChevronRight" Width="10"/>
                        </Button>
                        <Button Style="{StaticResource Styles.Button.Icon.Rectangle}" Command="{Binding NextStableCmd}" >
                            <iconPacks:PackIconMaterial Kind="ChevronDoubleRight" />
                        </Button>
                        <Button Style="{StaticResource Styles.Button.Icon.Rectangle}" Command="{Binding NewestCmd}" Background="{StaticResource Badges.BlackBackground}">
                            <iconPacks:PackIconMaterial Kind="ArrowCollapseRight" />
                        </Button>
                    </StackPanel>
                    <Grid Grid.Column="1" Grid.RowSpan="2" Panel.ZIndex="2" 
                  VerticalAlignment="Top" HorizontalAlignment="Left" >

                        <StackPanel Orientation="Horizontal">
                            <StackPanel>
                                <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" Margin="5">

                                    <StackPanel Orientation="Horizontal" Margin="5,0">
                                        <TextBlock Style="{StaticResource Text.FieldHeaderEditable2}" Text="ID:" />
                                        <TextBox Style="{StaticResource Text.FieldContentInput2}" Text="{Binding Number}"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal" Visibility="{Binding IsVaild,Converter={StaticResource visbilityconv}}">
                                        <StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" >
                                            <TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding Time,StringFormat={}{0:MM-dd HH:mm:ss}}"/>
                                            <TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="至"/>
                                            <TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding EndTime,StringFormat={}{0:HH:mm:ss}}"/>
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal" >
                                            <TextBlock Style="{StaticResource Text.FieldContentMm2}" >
                                                [<Run Text="{Binding ScanDataId,Mode=OneWay}"/>]
                                            </TextBlock>
                                        </StackPanel>
                                    </StackPanel>

                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Visibility="{Binding IsVaild,Converter={StaticResource visbilityconv}}">

                                    <StackPanel Orientation="Horizontal" Background="{StaticResource Badges.Background}" Margin="{StaticResource Badges.Margin}">
                                        <TextBlock Style="{StaticResource Text.FieldHeader2}"  Text="膜宽:" />
                                        <TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding FilmWidth}" />
                                        <TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="mm"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal" Background="{StaticResource Badges.Background}" Margin="{StaticResource Badges.Margin}">
                                        <TextBlock Style="{StaticResource Text.FieldHeader2}"  Text="速度:" />
                                        <TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding FilmVelocity,StringFormat={}{0:F1}}" />
                                        <TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="m/min"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal" Background="{StaticResource Badges.Background}" Margin="{StaticResource Badges.Margin}">
                                        <TextBlock Style="{StaticResource Text.FieldHeader2}"  Text="加热时间:" />
                                        <TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding HTime,StringFormat={}{0:HH:mm:ss}}" />
                                        <TextBlock Style="{StaticResource Text.FieldContent2}" Text="未起效" Foreground="Red" Visibility="{Binding IsStable,Converter={StaticResource visbilityconv}, ConverterParameter=HiddenWhenTrue}"/>
                                    </StackPanel>
                                </StackPanel>
                                <!--<StackPanel Orientation="Horizontal" Visibility="{Binding IsVaild,Converter={StaticResource visbilityconv}}">

                                    <StackPanel Orientation="Horizontal" Background="{StaticResource Badges.Background}" Margin="{StaticResource Badges.Margin}">
                                        <TextBlock Style="{StaticResource Text.FieldHeader2}"  Text="左无效:" />
                                        <TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding LeftEmptyBolts}" />
                                        <TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="螺丝"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal" Background="{StaticResource Badges.Background}" Margin="{StaticResource Badges.Margin}">
                                        <TextBlock Style="{StaticResource Text.FieldHeader2}"  Text="右无效:" />
                                        <TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding RightEmptyBolts}" />
                                        <TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="螺丝"/>
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal" Background="{StaticResource Badges.Background}" Margin="{StaticResource Badges.Margin}">
                                        <TextBlock Style="{StaticResource Text.FieldHeader2}"  Text="收缩率:" />
                                        <TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding UniformShrinkPercent,StringFormat={}{0:P1}}" />
                                    </StackPanel>
                                    <StackPanel Orientation="Horizontal" Background="{StaticResource Badges.Background}" Margin="{StaticResource Badges.Margin}">
                                        <TextBlock Style="{StaticResource Text.FieldHeader2}"  Text="偏移:" />
                                        <TextBlock Style="{StaticResource Text.FieldContent2}" Text="{Binding MidOffset}" />
                                        <TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="mm"/>
                                    </StackPanel>
                                </StackPanel>-->
                            </StackPanel>
                        </StackPanel>
                    </Grid>
                    <StackPanel Grid.Column="2" Grid.RowSpan="2" Panel.ZIndex="1" VerticalAlignment="Top" HorizontalAlignment="Right">
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                            <StackPanel Margin="{StaticResource Badges.Margin}">
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="最新:"/>
                                    <TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="{Binding LastId}"/>
                                </StackPanel>
                                <StackPanel Orientation="Horizontal" Visibility="{Binding IsVaild,Converter={StaticResource visbilityconv}}">
                                    <TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="当前:"/>
                                    <TextBlock Style="{StaticResource Text.FieldContentMm2}" Text="{Binding Id}"/>
                                </StackPanel>
                            </StackPanel>
                            
                            <TextBlock Style="{StaticResource Styles.Card.Title}" Text="{Binding Title}"/>
                        </StackPanel>
                        <Grid
                  Margin="10,0" 
                  Background="{StaticResource SemiTransparentGreyBrush}" >
                            <Viewbox MaxHeight="25">
                                <StackPanel Margin="5">
                                    <StackPanel.Resources>
                                        <Style TargetType="Viewbox">
                                            <Setter Property="Height" Value="25"/>
                                            <Setter Property="Width" Value="120"/>
                                            <Setter Property="HorizontalAlignment" Value="Left"/>
                                            <Setter Property="VerticalAlignment" Value="Top"/>
                                        </Style>
                                    </StackPanel.Resources>
                                    <StackPanel Orientation="Horizontal">
                                        <Viewbox >
                                            <StackPanel Orientation="Horizontal" Background="{StaticResource Badges.BlackBackground}" >
                                                <TextBlock Style="{StaticResource Text.FieldHeader2}" Foreground="{StaticResource Badges.BlackForeground}" 
                                                           Text="平均: "/>
                                                <TextBlock Style="{StaticResource Text.FieldContent2}" 
                                                   Foreground="{StaticResource WhiteBrush}"
                                                   Background="{StaticResource TextBrush}"
                                                   Text="{Binding Average,StringFormat={}{0:F1}}" 
                                                   />
                                            </StackPanel>
                                        </Viewbox>
                                        <Viewbox>
                                            <StackPanel Orientation="Horizontal" Background="{StaticResource Badges.BlackBackground}">
                                                <TextBlock Style="{StaticResource Text.FieldHeader2}" Foreground="{StaticResource Badges.BlackForeground}"
                                           Text="  2σ: " 
                                           />
                                                <TextBlock Style="{StaticResource Text.FieldContent2}" 
                                           Foreground="{StaticResource WhiteBrush}"
                                           Background="{StaticResource TextBrush}"
                                           Text="{Binding Sigma2Percent,StringFormat={}{0:P1}}"  
                                           />
                                            </StackPanel>
                                        </Viewbox>
                                    </StackPanel>
                                </StackPanel>
                            </Viewbox>
                        </Grid>
                    </StackPanel>

                </Grid>

            </StackPanel>

        </Border>
    </Grid>
</UserControl>
