<Page x:Class="FLY.Thick.Base.UI.PgCurve"
      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:Chr="clr-namespace:System.Windows.Forms.DataVisualization.Charting;assembly=System.Windows.Forms.DataVisualization"
      xmlns:local="clr-namespace:FLY.Thick.Base.UI"   
      xmlns:common="clr-namespace:FLY.Thick.Base.Common;assembly=FLY.Thick.Base"
      mc:Ignorable="d" 
      d:DesignHeight="768" d:DesignWidth="1024"
      Background="WhiteSmoke"
	Title="Page_Curve">
    <Page.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.Thick.Base.UI;component/Culture/StringResource.zh-CN.xaml"/>-->
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Background="{StaticResource Brushes.TitleBar.Background}">
            <Button Style="{StaticResource Styles.TitleBar.BackButton2}" Command="BrowseBack"/>
            <TextBlock Style="{StaticResource TextBlockStyle_Title}"  Text="AD曲线"/>
        </StackPanel>
        <Grid Grid.Row="1" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="auto" />
                <ColumnDefinition Width="784*" />
            </Grid.ColumnDefinitions>
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto" />
                    <RowDefinition Height="247*" />
                    <RowDefinition Height="auto" />
                </Grid.RowDefinitions>
                <StackPanel>
                    <StackPanel Margin="{StaticResource ControlMargin}">
                        <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="曲线类型" />
                        <ComboBox Width="191" HorizontalAlignment="Left">
                            <ComboBoxItem IsSelected="{Binding Flag, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:CurveType.E}}">
                                <TextBlock Style="{StaticResource Styles.Text.FieldContent}"  FontSize="32" Text="自然对数E"/>
                            </ComboBoxItem>
                            <ComboBoxItem IsSelected="{Binding Flag, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:CurveType.Line}}">
                                <TextBlock Style="{StaticResource Styles.Text.FieldContent}"  FontSize="32" Text="线性"/>
                            </ComboBoxItem>
                            <ComboBoxItem IsSelected="{Binding Flag, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:CurveType.X2}}" >
                                <TextBlock Style="{StaticResource Styles.Text.FieldContent}"  FontSize="32" Text="2次曲线"/>
                            </ComboBoxItem>
                        </ComboBox>
                    </StackPanel>
                    <StackPanel Margin="{StaticResource ControlMargin}">
                        <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="修正方式" />
                        <ComboBox Width="191" HorizontalAlignment="Left">
                            <ComboBoxItem IsSelected="{Binding CorrectWay, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:CurveCorrectWay.OnePointIsScale}}">
                                <TextBlock Style="{StaticResource Styles.Text.FieldContent}"  FontSize="32" Text="缩放"/>
                            </ComboBoxItem>
                            <ComboBoxItem IsSelected="{Binding CorrectWay, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:CurveCorrectWay.OnePointIsOffset}}">
                                <TextBlock Style="{StaticResource Styles.Text.FieldContent}"  FontSize="32" Text="平移"/>
                            </ComboBoxItem>
                        </ComboBox>
                    </StackPanel>
                </StackPanel>

                <DataGrid Grid.Row="1" AutoGenerateColumns="False" Width="200" TextBlock.FontSize="18" TextBlock.FontWeight="Normal" ItemsSource="{Binding Curves}">
                    <DataGrid.Columns>
                        <DataGridTextColumn Header="AD" Binding="{Binding AD}" Width="100"/>
                        <DataGridTextColumn Header="Value" Binding="{Binding Value}" Width="100"/>
                    </DataGrid.Columns>
                </DataGrid>
                <WrapPanel Grid.Row="2" Margin="{StaticResource ControlMargin}" Width="200">
                    <Button Content="应用" Style="{StaticResource Styles.Button.Square.Accent2}" Command="{Binding ApplyCmd}" />
                </WrapPanel>
                
            </Grid>
            <Grid  Grid.Column="1" >
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}" >
                    <Button Content="AD缩放" Style="{StaticResource Styles.Button.Square2}" Command="{Binding AdScaleCmd}"/>
                    <Button Content="VALUE缩放" Style="{StaticResource Styles.Button.Square2}" Command="{Binding ValueScaleCmd}"/>
                    <Button Content="修正" Style="{StaticResource Styles.Button.Square2}" Command="{Binding SetRevisedCmd}"/>
                    <Button Content="导出xlsx" Style="{StaticResource Styles.Button.Square2}" Command="{Binding SaveXlsxCmd}"/>
                    <Button Content="导入xlsx" Style="{StaticResource Styles.Button.Square2}" Command="{Binding LoadXlsxCmd}"/>
                </StackPanel>
                <WindowsFormsHost Grid.Row="1" Margin="{StaticResource ControlMargin}">
                    <Chr:Chart x:Name="chart1"/>
                </WindowsFormsHost>
            </Grid>

        </Grid>
    </Grid>
</Page>
