<Page x:Class="ThickTcpUiInWindow.Page_GetSample"
      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" 
      mc:Ignorable="d" 
      d:DesignHeight="1200" d:DesignWidth="1024"
      Background="White"
	Title="Page_GetSample" Loaded="Page_Loaded" Unloaded="Page_Unloaded">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="pack://application:,,,/FLY.ControlLibrary;component/Themes/Dictionary_MyStyle.xaml"/>
                <ResourceDictionary Source="pack://application:,,,/ThickTcpUiInWindow;component/Converter/Dictionary_MyConv.xaml"/>
                <!--<ResourceDictionary Source="pack://application:,,,/ThickTcpUiInWindow;component/Culture/StringResource.zh-CN.xaml"/>-->
            </ResourceDictionary.MergedDictionaries>
            <Style TargetType="{x:Type ToggleButton}" x:Key="ToggleButtonStyle_12" >
                <Setter Property="HorizontalContentAlignment" Value="Center"/>
                <Setter Property="VerticalContentAlignment" Value="Center"/>
                <Setter Property="Padding" Value="1"/>
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type ToggleButton}">
                            <Canvas x:Name="canvas" Height="45" Width="106" Background="#FF3B3B3B">
                                <Rectangle x:Name="Path_block" Fill="#FFFFFFFF" Height="36" Canvas.Left="5" Canvas.Top="5" Width="24"/>
                                <TextBlock x:Name="TextBlock_No" Text="斜率" Foreground ="White" Canvas.Left="35"   FontSize="30" />
                            </Canvas>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter TargetName="TextBlock_No" Property="Text" Value="平移"/>
                                    <Setter TargetName="TextBlock_No" Property="Canvas.Left" Value="10"/>
                                    <Setter TargetName="Path_block" Property="Canvas.Left" Value="77"/>
                                    <Setter TargetName="canvas" Property="Background" Value="#FF008BE5"/>
                                </Trigger>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>
        </ResourceDictionary>
    </Page.Resources>
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="496*" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <Grid Name="grid_null"/>
        <StackPanel Orientation="Horizontal" Background="{StaticResource Background_Title}">
            <Button Style="{StaticResource ButtonStyle_back2}" Command="BrowseBack"/>
            <TextBlock Style="{StaticResource TextBlockStyle_Title}"  Text="{DynamicResource strGetSample}"/>
        </StackPanel>
        <ScrollViewer CanContentScroll="True" PanningMode="Both" Grid.Row="1" >
            <StackPanel Orientation="Vertical" >
                <StackPanel Orientation="Horizontal" >
                    <Border Width="150" Background="{StaticResource Color_theme_activity}" Margin="0,5,5,5">
                        <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="{DynamicResource strBase}" />
                    </Border>
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Vertical" Margin="5">
                            <StackPanel Orientation="Horizontal">
                                <StackPanel Orientation="Vertical" Margin="5">
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strEnable}" />
                                    <ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Enable}"/>
                                </StackPanel>
                            </StackPanel>


                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="{DynamicResource strVelocity}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" Text="{Binding Velocity}" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                                        <Run >
                                            <MultiBinding Converter="{StaticResource outsp2mpminconv}" Mode="OneWay" StringFormat="{}{0:F1}">
                                            <Binding Path="Velocity" />
                                            <Binding Path="DataContext.Encoder1_mmpp"  ElementName="grid_null"/>
                                            <Binding Path="DataContext.Speed1Scale" ElementName="grid_null"/>
                                        </MultiBinding>
                                        </Run>
                                        <Run Text="m/min"/>
                                    </TextBlock>
                                </StackPanel>

                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strSampleRadius}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Range}" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                                        <Run>
                                            <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                                <Binding Path="Range" />
                                                <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                            </MultiBinding>
                                        </Run>
                                        <Run Text="mm"/>
                                    </TextBlock>
                                </StackPanel>

                            </StackPanel>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strSampleInterval}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Interval}" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="{DynamicResource strTimes}"/>
                                </StackPanel>

                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strMovingAverageFilters}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Window}" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="{DynamicResource strTimes}"/>
                                </StackPanel>
                            </StackPanel>
                            <Button Style="{StaticResource ResourceKey=ButtonStyle2}" Click="button_getorgad_Click" FontSize="27">
                                <StackPanel Orientation="Vertical">
                                    <TextBlock Text="{DynamicResource strCalculate}"/>
                                    <TextBlock Text="{DynamicResource strOrgAD}"/>
                                </StackPanel>
                            </Button>
                            <Button Style="{StaticResource ResourceKey=ButtonStyle2}" Click="button_gageinfo_Click" FontSize="27">
                                <StackPanel Orientation="Vertical">
                                    <TextBlock Text="{DynamicResource strGageInfo}"/>
                                </StackPanel>
                            </Button>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal" >
                    <Border Width="150" Background="#FF008BE5" Margin="0,5,5,5">
                        <TextBlock Foreground="#FFFFFFFF" FontWeight="Bold" FontSize="30" FontFamily="YouYuan" TextAlignment="Right" Margin="0,9,0,0">
                            <Run Text="{DynamicResource strSample}"/>
                            <Run Text="0"/>
                        </TextBlock>
                    </Border>
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strEnable}" />
                                <ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Samples[0].Enable}"/>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strNoCalibrate}" />
                                <ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding Samples[0].JustForCheck}"/>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strPosition}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Samples[0].Position}" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                                        <Run>
                                            <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                                <Binding Path="Samples[0].Position" />
                                                <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                            </MultiBinding>
                                        </Run>
                                        <Run Text="mm" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strOrgAD}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Samples[0].OrgAD}"/>
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal" >
                    <Border Width="150" Background="#FF008BE5" Margin="0,5,5,5">
                        <TextBlock Foreground="#FFFFFFFF" FontWeight="Bold" FontSize="30" FontFamily="YouYuan" TextAlignment="Right"  Margin="0,9,0,0">
                            <Run Text="{DynamicResource strSample}"/>
                            <Run Text="1"/>
                        </TextBlock>
                    </Border>
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strEnable}" />
                                <ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Samples[1].Enable}" />
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strNoCalibrate}" />
                                <ToggleButton Style="{StaticResource ToggleButtonStyle1}" HorizontalAlignment="Left" IsChecked="{Binding Samples[1].JustForCheck}"/>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strPosition}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Samples[1].Position}"/>
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm_interval}" Text="|" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                                        <Run>
                                            <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                                <Binding Path="Samples[1].Position" />
                                                <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                            </MultiBinding>
                                        </Run>
                                        <Run Text="mm" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strOrgAD}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Samples[1].OrgAD}"/>
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <Border Background="#FF008BE5" Margin="0,5,5,5" Width="150">
                        <TextBlock FontFamily="YouYuan" FontSize="30" FontWeight="Bold" Foreground="#FFFFFFFF" Margin="0,9,0,0" TextAlignment="Right" >
                            <Run Text="{DynamicResource strSample}"/>
                            <Run Text="2"/>
                        </TextBlock>
                    </Border>
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Margin="5" Orientation="Vertical">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strEnable}" />
                                <ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Samples[2].Enable}"/>
                            </StackPanel>
                            <StackPanel Margin="5" Orientation="Vertical">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strNoCalibrate}" />
                                <ToggleButton HorizontalAlignment="Left" IsChecked="{Binding Samples[2].JustForCheck}" Style="{StaticResource ToggleButtonStyle1}" />
                            </StackPanel>
                            <StackPanel Margin="5" Orientation="Vertical">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strPosition}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Samples[2].Position}" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm_interval}" Text="|" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}">
                                        <Run>
                                            <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                                <Binding Path="Samples[2].Position" />
                                                <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                            </MultiBinding>
                                        </Run>
                                        <Run Text="mm" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Margin="5" Orientation="Vertical">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strOrgAD}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Samples[2].OrgAD}" />
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <Border Background="#FF008BE5" Margin="0,5,5,5" Width="150">
                        <TextBlock FontFamily="YouYuan" FontSize="30" FontWeight="Bold" Foreground="#FFFFFFFF" Margin="0,9,0,0" Text="{DynamicResource strPositionCorrection}" TextAlignment="Right" />
                    </Border>
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Margin="5" Orientation="Vertical">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strSearchRange}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Search}" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm_interval}" Text="|" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}">
                                        <Run>
                                            <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                                <Binding Path="Search" />
                                                <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                            </MultiBinding>
                                        </Run>
                                        <Run Text="mm" /></TextBlock>
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <Border Background="#FF008BE5" Margin="0,5,5,5" Width="150">
                        <TextBlock FontFamily="YouYuan" FontSize="30" FontWeight="Bold" Foreground="#FFFFFFFF" Margin="0,9,0,0" Text="{DynamicResource strForwFeature}" TextAlignment="Right" />
                    </Border>
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Margin="5" Orientation="Vertical">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strEnable}" />
                                <ToggleButton  Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Features[0].Enable}"/>
                            </StackPanel>
                            <StackPanel Margin="5" Orientation="Vertical">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strPosition}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Features[0].StartPos}" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Text="-" />
                                    <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Features[0].EndPos}" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm_interval}" Text="|" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}">
                                        <Run>
                                            <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                                <Binding Path="Features[0].StartPos" />
                                                <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                            </MultiBinding>
                                        </Run>
                                        <Run Text="mm" />
                                        <Run Text="-" />
                                        <Run>
                                            <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                                <Binding Path="Features[0].EndPos" />
                                                <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                            </MultiBinding>
                                        </Run>
                                        <Run Text="mm" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
                <StackPanel Orientation="Horizontal">
                    <Border Background="#FF008BE5" Margin="0,5,5,5" Width="150">
                        <TextBlock FontFamily="YouYuan" FontSize="30" FontWeight="Bold" Foreground="#FFFFFFFF" Margin="0,9,0,0" Text="{DynamicResource strBackwFeature}"  TextAlignment="Right" />
                    </Border>
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Margin="5" Orientation="Vertical">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strEnable}" />
                                <ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding Features[1].Enable}" />
                            </StackPanel>
                            <StackPanel Margin="5" Orientation="Vertical">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strPosition}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Features[1].StartPos}" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}" Text="-" />
                                    <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Features[1].EndPos}" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm_interval}" Text="|" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}">
                                        <Run>
                                            <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                                <Binding Path="Features[1].StartPos" />
                                                <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                            </MultiBinding>
                                        </Run>
                                        <Run Text="mm" />
                                        <Run Text="-" />
                                        <Run>
                                            <MultiBinding Converter="{StaticResource p2mmconv}" Mode="OneWay" StringFormat="{}{0:F0}">
                                                <Binding Path="Features[1].EndPos" />
                                                <Binding Path="DataContext.Encoder1_mmpp" ElementName="grid_null"/>
                                            </MultiBinding>
                                        </Run>
                                        <Run Text="mm" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </StackPanel>
            </StackPanel>
        </ScrollViewer>
        <StackPanel Orientation="Horizontal"  Grid.Row="2" FlowDirection="RightToLeft" Margin="0,10,0,10">
            <Button Content="{DynamicResource strApply}" Style="{StaticResource ResourceKey=ButtonStyle2}" Click="button_apply_Click" />

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