<UserControl x:Class="FLY.FilmCasting.AutoDie.UI.Client.UiModule.AutoDieGraph"
      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.FilmCasting.AutoDie.UI.Client.UiModule"
      xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" 
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" xmlns:lvc1="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Feng.Wpf"
      mc:Ignorable="d" 
      d:DesignHeight="400" d:DesignWidth="980"
	 >
    <UserControl.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.FilmCasting.AutoDie.UI.Client;component/Themes/Colors.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/FLY.FilmCasting.AutoDie.UI.Client;component/Themes/Styles.xaml"/>
                
            </ResourceDictionary.MergedDictionaries>
            <ControlTemplate x:Key="picture_button" TargetType="Button">
                <Border Name="border" BorderThickness="1" CornerRadius="5">
                    <ContentPresenter Content="{TemplateBinding Content}"/>
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Setter TargetName="border" Property="BorderBrush" Value="LightBlue"/>
                    </Trigger>
                    <Trigger Property="IsPressed" Value="True">
                        <Setter TargetName="border" Property="Background" Value="LightGray"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
            <Style x:Key="AxisSectionStyle" TargetType="lvc:AxisSection" >
                <Setter Property="StrokeThickness" Value=".5"/>
                <Setter Property="DataLabel" Value="True"/>
                <Setter Property="DisableAnimations" Value="True"/>
                <Setter Property="DataLabelForeground" Value="White"/>
                <Setter Property="Panel.ZIndex" Value="1"/>
                <Setter Property="SectionOffset" Value="-0.5"/>
                <Setter Property="Fill" Value="{StaticResource Brushes.SelectBoltNo}"/>
                <Setter Property="Stroke" Value="{StaticResource Brushes.SelectBoltNo2}"/>
                <Setter Property="DataLabel" Value="False"/>
            </Style>
            <local:AirRingGraphVmUt x:Key="viewModel"/>

            <Geometry x:Key="Geometry.Close">
        M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z
            </Geometry>

        </ResourceDictionary>
    </UserControl.Resources>
    <Border Style="{StaticResource BorderStyle_module}" >
        <Grid Name="grid" d:DataContext="{StaticResource viewModel}">
            <Grid.RowDefinitions>
                <RowDefinition Height="auto" />
                <RowDefinition Height="258*" />
            </Grid.RowDefinitions>
            <Border Background="#F0579aab" Height="20" VerticalAlignment="Top" CornerRadius="3,3,0,0"/>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="auto" />
                    <ColumnDefinition Width="204*" />
                    <ColumnDefinition Width="auto" />
                </Grid.ColumnDefinitions>
                <Grid.Resources>
                    <ResourceDictionary>
                        <Style TargetType="Button" BasedOn="{StaticResource ButtonStyle_empty}">
                            <Setter Property="Width" Value="50"/>
                            <Setter Property="Margin" Value="2"/>
                        </Style>
                        <Style TargetType="Image" x:Key="ImageStyle">
                            <Setter Property="Height" Value="50"/>
                        </Style>
                        <Style TargetType="Image" BasedOn="{StaticResource ImageStyle}"/>

                        <Style TargetType="TextBlock" x:Key="TitleStyle">
                            <Setter Property="FontWeight" Value="Bold"/>
                            <Setter Property="FontFamily" Value="YouYuan"/>
                            <Setter Property="HorizontalAlignment" Value="Center"/>
                        </Style>
                        <Style TargetType="TextBlock" BasedOn="{StaticResource TitleStyle}"/>

                    </ResourceDictionary>
                </Grid.Resources>

                <Button Click="btnInfoClick">
                    <StackPanel>
                        <Image Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/info.png" />
                        <TextBlock Text="设置" />
                    </StackPanel>
                </Button>

                <StackPanel Orientation="Horizontal" Grid.Column="1" Visibility="{Binding CheckEnable, Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}" >
                    <Button Command="{Binding BaseUpCmd}" >
                        <StackPanel>
                            <Image Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/up.png"/>
                            <TextBlock Text="上升" />
                        </StackPanel>
                    </Button>
                    <Button Command="{Binding BaseDownCmd}" >
                        <StackPanel>
                            <Image Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/down.png" />
                            <TextBlock Text="下降" />
                        </StackPanel>
                    </Button>
                    <Button Command="{Binding AddCmd}">
                        <StackPanel>
                            <Image Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/add.png" />
                            <TextBlock Text="加热" />
                        </StackPanel>
                    </Button>
                    <Button Command="{Binding SubCmd}" >
                        <StackPanel>
                            <Image Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/cancel.png" />
                            <TextBlock Text="降温" />
                        </StackPanel>
                    </Button>
                    <Button Command="{Binding SmoothCmd}" >
                        <StackPanel>
                            <Image Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/apache_server.png" />
                            <TextBlock Text="平滑" />
                        </StackPanel>
                    </Button>
                    <Button Command="{Binding CalCmd}" >
                        <StackPanel>
                            <Image Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/aim.png" />
                            <TextBlock Text="计算" />
                        </StackPanel>
                    </Button>
                    <Button Command="{Binding ApplyCmd}" >
                        <StackPanel>
                            <Image Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/checkmark.png" />
                            <TextBlock Text="应用" />
                        </StackPanel>
                    </Button>
                    <Button Command="{Binding UndoCmd}" >
                        <StackPanel DataContext="{Binding FeedbackHeat}">
                            <Grid>
                                <Image Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/previous.png" />
                            </Grid>
                            <TextBlock >
                                <TextBlock.Style>
                                    <Style TargetType="TextBlock" BasedOn="{StaticResource TitleStyle}">
                                        <Setter Property="Text" Value="撤销"/>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding IsInUndo}" Value="True">
                                                <Setter Property="Text" Value="{Binding UndoTime,StringFormat={}{0:MM/dd}}"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>
                            <TextBlock Margin="0,0,0,-20">
                                <TextBlock.Style>
                                    <Style TargetType="TextBlock" BasedOn="{StaticResource TitleStyle}">
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding IsInUndo}" Value="True">
                                                <Setter Property="Text" Value="{Binding UndoTime,StringFormat={}{0:HH:mm}}"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </TextBlock.Style>
                            </TextBlock>
                        </StackPanel>
                    </Button>
                    <Button x:Name="btnClearH" Command="{Binding ClearCmd}" Template="{StaticResource picture_button}" >
                        <StackPanel>
                            <Grid>
                                <Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/close.png" />
                                <Grid DataContext="{Binding LPress}" 
                                  HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="{Binding IsRunning,Converter={StaticResource visbilityconv}}">
                                    <ed:Arc Width="45" Height="45" Opacity="0.9" 
                                        ArcThickness="4" 
                                        ArcThicknessUnit="Pixel" 
                                        StartAngle="0" EndAngle="360" 
                                        Fill="#FFF1F1F1" Stretch="None" Stroke="#FF988585" />
                                    <ed:Arc Width="45" Height="45"
                                    ArcThickness="4" 
                                    ArcThicknessUnit="Pixel"
                                    StartAngle="0" 
                                        EndAngle="{Binding Progress}"  
                                    Fill="#FF5C7AA0" Stretch="None" Stroke="#FF988585" Opacity="0.9" >
                                    </ed:Arc>
                                </Grid>
                            </Grid>
                            <TextBlock Text="清除" />
                        </StackPanel>
                    </Button>
                    <Button Command="{Binding SaveCmd}" >
                        <StackPanel>
                            <Image Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/diskette.png" />
                            <TextBlock Text="保存" />
                        </StackPanel>
                    </Button>
                    <Button Command="{Binding LoadCmd}" >
                        <StackPanel>
                            <Image Source="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/open_folder.png" />
                            <TextBlock Text="读取" />
                        </StackPanel>
                    </Button>

                </StackPanel>

                <StackPanel Orientation="Horizontal" Grid.Column="3">

                    <StackPanel Orientation="Horizontal">
                        <Button Command="{Binding CheckCmd}" Visibility="{Binding FeedbackHeat.HasCheck, Converter={StaticResource visbilityconv}}" >
                            <StackPanel DataContext="{Binding FeedbackHeat}">
                                <Grid >
                                    <Rectangle Fill="Yellow" RadiusX="5" RadiusY="5" Visibility="{Binding HasElectricity, Converter={StaticResource visbilityconv}}"/>
                                    <Image>
                                        <Image.Style>
                                            <Style TargetType="Image" BasedOn="{StaticResource ImageStyle}">
                                                <Setter Property="Source" Value="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/nurse.png"/>
                                                <Style.Triggers>
                                                    <DataTrigger Binding="{Binding CheckEnable}" Value="False">
                                                        <Setter Property="Source" Value="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/nurse_gray.png"/>
                                                    </DataTrigger>
                                                </Style.Triggers>
                                            </Style>
                                        </Image.Style>
                                    </Image>
                                </Grid>
                                <TextBlock Style="{StaticResource TitleStyle}" Text="检查" />
                            </StackPanel>
                        </Button>
                        <Button Command="{Binding EnableCmd}"   >
                            <StackPanel DataContext="{Binding FeedbackHeat}">
                                <Image>
                                    <Image.Style>
                                        <Style TargetType="Image">
                                            <Setter Property="Source" Value="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/ligthbulb_on.png"/>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsAuto}" Value="False">
                                                    <Setter Property="Source" Value="/FLY.FilmCasting.AutoDie.UI.Client;component/Images/ligthbulb_off.png"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Image.Style>
                                </Image>
                                <TextBlock >
                                    <TextBlock.Style>
                                        <Style TargetType="TextBlock" BasedOn="{StaticResource TitleStyle}">
                                            <Setter Property="Text" Value="自动"/>
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding IsAuto}" Value="False">
                                                    <Setter Property="Text" Value="手动"/>
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </TextBlock.Style>
                                </TextBlock>
                            </StackPanel>
                        </Button>
                    </StackPanel>
                </StackPanel>
            </Grid>
            <Grid Grid.Row="1">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <lvc:CartesianChart Hoverable="False" DisableAnimations="True" DataTooltip="{x:Null}" Margin="5,2,2,2"
                                MouseMove="UIElement_OnMouseMove" MouseDown="UIElement_MouseDown" MouseUp="UIElement_MouseUp">
                    <lvc:CartesianChart.Series>
                        <lvc1:Column2Series 
                        PointGeometry="{x:Null}"
                        StrokeThickness ="1"
                        Stroke="Black"
                        Fill="{StaticResource Brushes.PreHeat}"
                        Values="{Binding HeatOffsets}"
                        Configuration="{Binding Mapper}"/>
                        <lvc:LineSeries 
                        PointGeometry="{x:Null}"
                        StrokeThickness ="3"
                        Stroke="{StaticResource Brushes.Thick}"
                        Fill="Transparent"
                        Values="{Binding ThickPercents}"
                        Configuration="{Binding MapperThickPercents}"/>
                        <!--<lvc:ScatterSeries
                        PointGeometry="{StaticResource Geometry.Close}"
                        StrokeThickness ="1"
                        Stroke="{StaticResource Brushes.Thick}"
                        Fill="{StaticResource WhiteBrush}"
                        Values="{Binding ThickPercents}"
                        Configuration="{Binding MapperThickPercentsWithIsStable}"/>-->
                    </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.Sections>
                                <lvc:AxisSection Style="{StaticResource AxisSectionStyle}" 
                                Value="{Binding SelectBoltNo}" SectionWidth="{Binding SelectBoltNoWidth}"
                            />
                            </lvc:Axis.Sections>
                        </lvc:Axis>

                    </lvc:CartesianChart.AxisX>
                    <lvc:CartesianChart.AxisY>
                        <lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}" 
                              LabelFormatter="{Binding YFormatter}"  
                              MinValue="-50" MaxValue="50" FontFamily="Courier New" >
                            <lvc:Axis.Separator>
                                <lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="10"/>
                            </lvc:Axis.Separator>
                        </lvc:Axis>
                    </lvc:CartesianChart.AxisY>
                </lvc:CartesianChart>
                <lvc:CartesianChart Grid.Row="1" Hoverable="False" DisableAnimations="True" DataTooltip="{x:Null}" Margin="5,2,2,2"
                                MouseMove="UIElement_OnMouseMove" MouseDown="UIElement_MouseDown" MouseUp="UIElement_MouseUp">
                    <lvc:CartesianChart.Series>
                        <lvc1:Column2Series 
                        PointGeometry="{x:Null}"
                        StrokeThickness ="1"
                        Stroke="Black"
                        Fill="{StaticResource Brushes.PreHeat}"
                        Values="{Binding PreHeats}"
                        Configuration="{Binding MapperPreHeats}"/>
                        <lvc:LineSeries 
                        PointGeometry="{x:Null}"
                        StrokeThickness ="3"
                        Stroke="{StaticResource Brushes.Heat}"
                        Fill="Transparent"
                        Values="{Binding Heats}"
                        Configuration="{Binding Mapper}"/>
                    </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.Sections>
                                <lvc:AxisSection Style="{StaticResource AxisSectionStyle}" 
                                Value="{Binding SelectBoltNo}" 
                                 SectionWidth="{Binding SelectBoltNoWidth}"
                                             
                            />
                            </lvc:Axis.Sections>
                        </lvc:Axis>
                    </lvc:CartesianChart.AxisX>
                    <lvc:CartesianChart.AxisY>
                        <lvc:Axis Foreground="{StaticResource Brushes.AxisLabel}" 
                              LabelFormatter="{Binding YFormatter}"  
                              MinValue="0" MaxValue="100" FontFamily="Courier New" >
                            <lvc:Axis.Separator>
                                <lvc:Separator Stroke="{StaticResource Brushes.AxisSeparator}" Step="10"/>
                            </lvc:Axis.Separator>
                        </lvc:Axis>
                    </lvc:CartesianChart.AxisY>
                </lvc:CartesianChart>
            </Grid>
        </Grid>
    </Border>
</UserControl>
