<Page x:Class="FLY.FeedbackRenZiJia.UI.Client.UIModule.Page_Graph"
      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:my="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"  
      xmlns:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
      xmlns:local="clr-namespace:FLY.FeedbackRenZiJia.UI.Client.UIModule"
      xmlns:iservice="clr-namespace:FLY.FeedbackRenZiJia.IService;assembly=FLY.FeedbackRenZiJia" 
      xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" 
      mc:Ignorable="d" 
      d:DesignHeight="400" d:DesignWidth="980"
	Title="Page_Graph" Unloaded="Page_Unloaded" Loaded="Page_Loaded">
    <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.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>
        </ResourceDictionary>
    </Page.Resources>

    <Grid Name="grid" Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="258*" />
        </Grid.RowDefinitions>

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="18" />
                <RowDefinition Height="32" />
            </Grid.RowDefinitions>
            <Rectangle Fill="#FF579aab"/>
        </Grid>
        
        <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">
                        <Setter Property="Height" Value="50"/>
                    </Style>
                    <Style TargetType="TextBlock" >
                        <Setter Property="FontWeight" Value="Bold"/>
                        <Setter Property="FontFamily" Value="YouYuan"/>
                        <Setter Property="HorizontalAlignment" Value="Center"/>
                    </Style>
                </ResourceDictionary>
            </Grid.Resources>

            <Button Click="button_graphset_click">
                    <StackPanel>
                        <Image Source="/FLY.FeedbackRenZiJia.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 Click="button_baseup_click" >
                    <StackPanel>
                        <Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/up.png"/>
                        <TextBlock Text="上升" />
                    </StackPanel>
                </Button>
                <Button Click="button_basedown_click" >
                    <StackPanel>
                        <Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/down.png" />
                        <TextBlock Text="下降" />
                    </StackPanel>
                </Button>
                <Button Click="button_add_click" >
                    <StackPanel>
                        <Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/add.png" />
                        <TextBlock Text="加热" />
                    </StackPanel>
                </Button>
                <Button Click="button_sub_click" >
                    <StackPanel>
                        <Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/cancel.png" />
                        <TextBlock Text="降温" />
                    </StackPanel>
                </Button>
                <Button Click="button_cal_click" >
                    <StackPanel>
                        <Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/aim.png" />
                        <TextBlock Text="计算" />
                    </StackPanel>
                </Button>
                <Button Click="button_apply_click" >
                    <StackPanel>
                        <Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/checkmark.png" />
                        <TextBlock Text="应用" />
                    </StackPanel>
                </Button>
                <Button Click="button_undo_click" >
                    <StackPanel>
                        <Grid>
                            <Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/previous.png" />
                            <Grid HorizontalAlignment="Left" VerticalAlignment="Bottom" >
                                <Ellipse Fill="#FF2F5070" Width="25" Height="25" Opacity="0.8"/>
                                <TextBlock Text="{Binding UndoIdx}" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="White"  FontFamily="Arial" FontSize="10"/>
                            </Grid>
                        </Grid>
                        <TextBlock Text="撤销" />
                    </StackPanel>
                </Button>
                <Button x:Name="button_clear_h" Click="button_clear_h_click" Template="{StaticResource picture_button}" >
                    <StackPanel>
                        <Grid>
                            <Image HorizontalAlignment="Center" VerticalAlignment="Center" Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/close.png" />
                            <Grid HorizontalAlignment="Center" VerticalAlignment="Center" x:Name="grid_longpress" 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 Click="button_save_click" >
                    <StackPanel>
                        <Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/diskette.png" />
                        <TextBlock Text="保存" />
                    </StackPanel>
                </Button>
                <Button Click="button_load_click" >
                    <StackPanel>
                        <Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/open_folder.png" />
                        <TextBlock Text="读取" />
                    </StackPanel>
                </Button>

            </StackPanel>

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

                <StackPanel Orientation="Horizontal">
                    <Button Click="button_checkenable_click" Visibility="{Binding HasCheck, Converter={StaticResource visbilityconv}}" >
                        <StackPanel>
                            <Grid >
                                <Rectangle Fill="Yellow" RadiusX="5" RadiusY="5" Visibility="{Binding HasElectricity, Converter={StaticResource visbilityconv}}"/>
                                <Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/nurse.png" Visibility="{Binding CheckEnable, Converter={StaticResource visbilityconv}}" />
                                <Image Source="/FLY.FeedbackRenZiJia.UI.Client;component/Images/nurse_gray.png" Visibility="{Binding CheckEnable, Converter={StaticResource visbilityconv},ConverterParameter=HiddenWhenTrue}" />
                            </Grid>
                            <TextBlock Text="检查" />
                        </StackPanel>
                    </Button>
                    <Button Click="button_enable_click"   >
                        <StackPanel>
                            <Image>
                                <Image.Style>
                                    <Style TargetType="Image">
                                        <Setter Property="Source" Value="/FLY.FeedbackRenZiJia.UI.Client;component/Images/ligthbulb_on.png"/>
                                        <Style.Triggers>
                                            <DataTrigger Binding="{Binding IsAuto}" Value="False">
                                                <Setter Property="Source" Value="/FLY.FeedbackRenZiJia.UI.Client;component/Images/ligthbulb_off.png"/>
                                            </DataTrigger>
                                        </Style.Triggers>
                                    </Style>
                                </Image.Style>
                            </Image>
                            <TextBlock Text="自动" />
                        </StackPanel>
                    </Button>
                </StackPanel>
            </StackPanel>
        </Grid>

        <WindowsFormsHost Grid.Row="2">
            <Chr:Chart x:Name="chart1" />
        </WindowsFormsHost>
    </Grid>
</Page>