<Page x:Class="ThickTcpUiInWindow.Page_Initparam"
      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:ThickTcpUiInWindow"   
      xmlns:common="clr-namespace:FLY.Thick.Base.Common;assembly=FLY.Thick.Base"
      mc:Ignorable="d" 
      d:DesignHeight="900" d:DesignWidth="1024"
      Loaded="Page_Loaded" Unloaded="Page_UnLoaded"
      Background="White"
	Title="Page_Initparam">
    <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>
            <local:DataValidSrcConverter x:Key="datavalidsrc2boolconv" />
            <local:FilmVSRCConverter x:Key="filmvsrc2boolconv" />
        </ResourceDictionary>
    </Page.Resources>
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="496*" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <StackPanel Orientation="Horizontal" Background="{StaticResource Background_Title}">
            <Button Style="{StaticResource ButtonStyle_back2}" Command="BrowseBack"/>
            <TextBlock Style="{StaticResource TextBlockStyle_Title}" Text="{DynamicResource strSystemParam}"/>
        </StackPanel>
        <ScrollViewer CanContentScroll="True" PanningMode="Both" Grid.Row="1" >
            <StackPanel Orientation="Vertical" >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto"/>
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Border Width="150" Background="{StaticResource Color_theme_activity}" Margin="0,5,5,5">
                        <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="{DynamicResource strBase}" />
                    </Border>

                    <StackPanel Grid.Column="1" Orientation="Vertical">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strDBSize}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding DBKeepMonth}" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="{DynamicResource strMonth}" />
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strOrgInterval}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding AutoOrgInterval}" />
                                    <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 strGageLength}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding PosLength}" />
                                    <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="PosLength" />
                                    <Binding Path="Encoder1_mmpp"/>
                                </MultiBinding>
                            </Run>
                            <Run Text="mm"/>
                                    </TextBlock>
                                </StackPanel>

                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strEncoder1Scale}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Encoder1_mmpp}" HorizontalAlignment="Left"/>
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" Text="{DynamicResource strMmOfPulse}"/>
                                </StackPanel>

                            </StackPanel>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strFilmVSrc}" />
                                <ComboBox Width="191" MinHeight="40" HorizontalAlignment="Left">
                                    <ComboBoxItem x:Name="comboBoxotem_EN2" IsSelected="{Binding FilmVSrc, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:FilmVSRC.EN2}}">
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strEncoder2}"/>
                                    </ComboBoxItem>
                                    <ComboBoxItem x:Name="comboBoxotem_ROUND" IsSelected="{Binding FilmVSrc, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:FilmVSRC.ROUND}}">
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strRollSignal}"/>
                                    </ComboBoxItem>
                                </ComboBox>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Visibility="{Binding IsSelected,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed, ElementName=comboBoxotem_EN2}">
                                <StackPanel Orientation="Vertical" Margin="5">
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strEncoder2Scale}" />
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Encoder2_mmpp}"  HorizontalAlignment="Left"/>
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                                            <Run Text="mm/脉冲"/>
                                        </TextBlock>
                                    </StackPanel>
                                </StackPanel>
                                <StackPanel Orientation="Vertical" Margin="5">
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strEncoder2Scaling}" />
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Encoder2_comp}"  HorizontalAlignment="Left"/>
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                                            <Run Text="倍"/>
                                        </TextBlock>
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Horizontal" Visibility="{Binding IsSelected,Converter={StaticResource ResourceKey=visbilityconv},ConverterParameter=Collapsed, ElementName=comboBoxotem_ROUND}">

                                <StackPanel Orientation="Vertical" Margin="5">
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strRollerPerimeter}" />
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox HorizontalAlignment="Left" MaxWidth="150" Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding MmOfR,StringFormat={}{0:F1}}" />
                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="mm" />
                                    </StackPanel>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strFilmVThreshold}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding FilmVThreshold}"  HorizontalAlignment="Left"/>
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                                            <Run Text="m/min"/>
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>

                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strDataValidSrc}" />
                                <ComboBox Width="191" MinHeight="40" HorizontalAlignment="Left">
                                    <ComboBoxItem x:Name="comboBoxotem_byen2"  IsSelected="{Binding DataValidSrc, Converter={StaticResource datavalidsrc2boolconv}, ConverterParameter=BYEN2}">
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strFilmVelocity}"/>
                                    </ComboBoxItem>
                                    <ComboBoxItem  x:Name="comboBoxotem_byinput"  IsSelected="{Binding DataValidSrc, Converter={StaticResource datavalidsrc2boolconv}, ConverterParameter=BYINPUT}">
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strLocalInput}"/>
                                    </ComboBoxItem>
                                    <ComboBoxItem  x:Name="comboBoxotem_valid"  IsSelected="{Binding DataValidSrc, Converter={StaticResource datavalidsrc2boolconv}, ConverterParameter=VALID}" >
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strLongEffective}"/>
                                    </ComboBoxItem>
                                    <ComboBoxItem  x:Name="comboBoxotem_invalid"  IsSelected="{Binding DataValidSrc, Converter={StaticResource datavalidsrc2boolconv}, ConverterParameter=INVALID}">
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strLongFailed}"/>
                                    </ComboBoxItem>
                                </ComboBox>
                            </StackPanel>

                        </StackPanel>

                    </StackPanel>
                </Grid>

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="auto"/>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Border Grid.Column="0" Width="150" Background="{StaticResource Color_theme_activity}" Margin="0,5,5,5">
                            <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="{DynamicResource strVelocity}"/>
                        </Border>
                        <WrapPanel Grid.Column="1" Orientation="Horizontal">
                        <StackPanel Orientation="Horizontal">
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strVScan}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding VScan}" HorizontalAlignment="Left"/>
                                    <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="VScan" />
                                            <Binding Path="Encoder1_mmpp" />
                                            <Binding Path="Speed1Scale" />
                                        </MultiBinding>
                                </Run>
                                    
                                <Run Text="m/min" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strVAccuracy}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding VAccuracy}" />
                                    <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="VAccuracy" />
                                            <Binding Path="Encoder1_mmpp" />
                                            <Binding Path="Speed1Scale" />
                                        </MultiBinding>
                                </Run>
                                <Run Text="m/min" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strVTest}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding VJOG}" />
                                    <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="VJOG" />
                                            <Binding Path="Encoder1_mmpp" />
                                            <Binding Path="Speed1Scale" />
                                        </MultiBinding>
                                </Run>
                                <Run Text="m/min" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>


                            <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strSVelocity}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding SVelocity}" />
                                    <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="SVelocity" />
                                            <Binding Path="Encoder1_mmpp" />
                                            <Binding Path="Speed1Scale" />
                                        </MultiBinding>
                                </Run>
                                <Run Text="m/min" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>

                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strHVelocity1}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding HVelocity1}" />
                                    <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="HVelocity1" />
                                            <Binding Path="Encoder1_mmpp" />
                                            <Binding Path="Speed1Scale" />
                                        </MultiBinding>
                                </Run>
                                <Run Text="m/min" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strHVelocity2}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding HVelocity2}" />
                                    <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="HVelocity2" />
                                            <Binding Path="Encoder1_mmpp" />
                                            <Binding Path="Speed1Scale" />
                                        </MultiBinding>
                                </Run>
                                <Run Text="m/min" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>

                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strATime}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding ATime}" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                                <Run Text="ms" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strDTime}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding DTime}" />
                                    <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent_mm}" >
                                <Run Text="ms" />
                                    </TextBlock>
                                </StackPanel>
                            </StackPanel>

                        </WrapPanel>
                    </Grid>

            </StackPanel>
        </ScrollViewer>
        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" >
            <Button Style="{StaticResource ButtonStyle_empty}" HorizontalAlignment="Right" VerticalAlignment="Bottom" Click="button_apply_Click" Margin="0,0,20,-45" >
                <Grid >
                    <Ellipse Fill="White" Height="90" Width="90"/>
                    <Path Data="{StaticResource Geometry_check-circle}" Fill="#FF31AE15" Stretch="Fill" Height="80" Width="80" />
                </Grid>
            </Button>
        </StackPanel>
    </Grid>
</Page>
