<Page x:Class="ThickTcpUiInWindow.Page_FlyAD"
      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="1200" d:DesignWidth="1024"
      Background="White"
	Title="Page_FlyAD" 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>
        </ResourceDictionary>
    </Page.Resources>
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition Height="496*" />
        </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 strController}"/>
        </StackPanel>
        <ScrollViewer CanContentScroll="True" PanningMode="Both" Grid.Row="1" >
            <StackPanel Orientation="Vertical" >
                <Grid >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Button Style="{StaticResource ResourceKey=ButtonStyle3}" Width="150" Margin="0,5,5,5" Click="button_apply_Click" >
                        <StackPanel Orientation="Vertical">
                            <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="{DynamicResource strParam}"/>
                            <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="{DynamicResource strApply}"/>
                        </StackPanel>
                    </Button>
                    <StackPanel Grid.Column="1" Orientation="Vertical">
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strIPAddress}" />
                            <StackPanel Orientation="Horizontal">
                                <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding EP, Converter={StaticResource ResourceKey=ipepconv}}" Tag="Full" />
                            </StackPanel>
                        </StackPanel>
                        <WrapPanel Orientation="Horizontal">
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="CRC" />
                                <ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding HasCRC}"/>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5" >
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strPulseOfGrid}" />
                                <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding PosOfGrid}" />
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5" >
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strGridSmooth}" />
                                <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding GridSmooth}" />
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strMotorType}" />
                                <ComboBox Width="191" HorizontalAlignment="Left" MinHeight="40">

                                    <ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.SERVO}}">
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strServo}"/>
                                    </ComboBoxItem>
                                    <ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.VF0}}" >
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strVF0}"/>
                                    </ComboBoxItem>
                                    <ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.NULL}}" >
                                        <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}"  FontSize="32" Text="{DynamicResource strNull}"/>
                                    </ComboBoxItem>
                                </ComboBox>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strMotorPulse}" />
                                <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Ratio01}" />
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strEncoderPulse}" />
                                <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding Ratio02}" />
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strOrgPos}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding PosOffset}" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="{DynamicResource strPulse}"/>
                                </StackPanel>
                                
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strJogVelocity}" />
                                <TextBox Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding JogVelocity}" />
                            </StackPanel>
                        </WrapPanel>
                    </StackPanel >
                </Grid>
                <Grid Margin="0,5,0,5">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto" />
                        <ColumnDefinition/>
                        <ColumnDefinition Width="auto" />
                    </Grid.ColumnDefinitions>
                    <Border Width="150" Background="{StaticResource Color_theme_activity}" Margin="0,5,5,5">
                        <StackPanel>
                            <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}"  Text="{DynamicResource strOperation}"/>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeader}" Text="{DynamicResource strCurrPulse}" Foreground="#FFCECECE" HorizontalAlignment="Right" />
                                <TextBlock Name="textblock_position"  Style="{StaticResource ResourceKey=TextBlockStyle_FieldContent}" Text="{Binding Position}" HorizontalAlignment="Right" Foreground="White" />
                            </StackPanel>
                        </StackPanel>
                        
                    </Border>
                    <StackPanel Orientation="Vertical" Grid.Column="1" Visibility="{Binding MotorType, Converter={StaticResource e2hiddenconv}, ConverterParameter={x:Static common:MOTORTYPE.NULL}}">
                        <StackPanel.Resources>
                            <Style TargetType="Button" BasedOn="{StaticResource ResourceKey=ButtonStyle2}">
                                <Setter Property="Margin" Value="5"/>
                                <Setter Property="Height" Value="75"/>
                                <Setter Property="Width" Value="140"/>
                            </Style>
                        </StackPanel.Resources>
                        <StackPanel Orientation="Horizontal">


                            <Button Content="{DynamicResource strBackward}" Click="button_backw_Click" />
                            <Button Content="{DynamicResource strForward}" Click="button_forw_Click" />
                            <Button Content="{DynamicResource strOrg}" Click="button_org_Click" />
                            <Button Content="{DynamicResource strStop}" Click="button_stop_Click" />


                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Button Content="{DynamicResource strRunto}" Click="button_runto_Click" />
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="{DynamicResource strTargetPosition}" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Name="textbox_targetpos" Style="{StaticResource ResourceKey=TextBoxStyle_FieldContent}" Text="{Binding TargetPos}" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="{DynamicResource strPulse}"/>
                                </StackPanel>
                            </StackPanel>

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

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