<Page x:Class="FLY.Thick.Base.UI.PgFlyAd"
      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:FLY.Thick.Base.UI"  
      xmlns:common="clr-namespace:FLY.Thick.Base.Common;assembly=FLY.Thick.Base"
      mc:Ignorable="d" 
      d:DesignHeight="1200" d:DesignWidth="1024"
      Background="WhiteSmoke"
      d:DataContext="{d:DesignInstance local:PgFlyAdVm}"
	>
    <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.MergedDictionaries>
        </ResourceDictionary>
    </Page.Resources>
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="auto" />
            <RowDefinition />
        </Grid.RowDefinitions>
        <Grid Background="{StaticResource Background_Title}" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" >
            <Button Style="{StaticResource ButtonStyle_back2}" Command="BrowseBack" />
            <TextBlock Style="{StaticResource TextBlockStyle_Title}"  Text="控制器"/>
            </StackPanel>
            <local:CtMicroGage Grid.Column="1" x:Name="mircoGage" Background="Transparent" VerticalAlignment="Bottom"/>
        </Grid>
        <ScrollViewer CanContentScroll="True" PanningMode="Both" Grid.Row="1" >
            <StackPanel Orientation="Vertical" >
                <Grid >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="auto" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Button Style="{StaticResource ButtonStyle_paramSection}" Command="{Binding ApplyCmd}" >
                        <StackPanel Orientation="Vertical">
                            <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="参数"/>
                            <TextBlock Style="{StaticResource TextBlockStyle_ItemHeader}" Text="应用"/>
                        </StackPanel>
                    </Button>
                    <StackPanel Grid.Column="1" Orientation="Vertical">
                        <StackPanel Orientation="Vertical" Margin="5">
                            <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="IP地址:端口" />
                            <StackPanel Orientation="Horizontal">
                                <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding EP, Converter={StaticResource ipepconv}}" Tag="Full" />
                            </StackPanel>
                        </StackPanel>
                        <WrapPanel Orientation="Horizontal">
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="CRC" />
                                <ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding HasCRC}"/>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource ResourceKey=TextBlockStyle_FieldHeaderEditable}" Text="不使用AD盒速度" />
                                <ToggleButton Style="{StaticResource ToggleButtonStyle1}" IsChecked="{Binding IsCalSpeed}" HorizontalAlignment="Left"/>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5" >
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="脉冲/数据格" />
                                <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding PosOfGrid}" />
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5" >
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="数据平滑" />
                                <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding GridSmooth}" />
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="电机类型" />
                                <ComboBox Width="191" HorizontalAlignment="Left" MinHeight="40">

                                    <ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.SERVO}}">
                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}"  FontSize="32" Text="伺服"/>
                                    </ComboBoxItem>
                                    <ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.VF0}}" >
                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}"  FontSize="32" Text="变频器"/>
                                    </ComboBoxItem>
                                    <ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.NULL}}" >
                                        <TextBlock Style="{StaticResource TextBlockStyle_FieldContent}"  FontSize="32" Text="无"/>
                                    </ComboBoxItem>
                                </ComboBox>
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="电机脉冲" />
                                <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Ratio01}" />
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="编码脉冲" />
                                <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding Ratio02}" />
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="原点位置" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding PosOffset}" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="脉冲"/>
                                </StackPanel>
                                
                            </StackPanel>
                            <StackPanel Orientation="Vertical" Margin="5">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="JOG速度" />
                                <TextBox Style="{StaticResource 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 Style="{StaticResource BorderStyle_paramSection}">
                        <TextBlock Text="操作"/>
                    </Border>
                    <StackPanel Grid.Column="1" Visibility="{Binding MotorType, Converter={StaticResource e2hiddenconv}, ConverterParameter={x:Static common:MOTORTYPE.NULL}}">
                        <StackPanel.Resources>
                            <Style TargetType="Button" BasedOn="{StaticResource ButtonStyle2}">
                                <Setter Property="Margin" Value="5"/>
                                <Setter Property="Height" Value="75"/>
                                <Setter Property="Width" Value="140"/>
                            </Style>
                        </StackPanel.Resources>
                        <StackPanel Orientation="Horizontal">


                            <Button Content="反行" Command="{Binding BackwCmd}" />
                            <Button Content="正行" Command="{Binding ForwCmd}" />
                            <Button Content="归零" Command="{Binding OrgCmd}" />
                            <Button Content="停止" Command="{Binding StopCmd}" />


                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Button Content="运行至" Command="{Binding RunToCmd}" />
                            <StackPanel Margin="{StaticResource ControlMargin}">
                                <TextBlock Style="{StaticResource TextBlockStyle_FieldHeaderEditable}" Text="目标位置" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource TextBoxStyle_FieldContent}" Text="{Binding TargetPos}" />
                                    <TextBlock Style="{StaticResource TextBlockStyle_FieldContent_mm}" Text="脉冲"/>
                                </StackPanel>
                            </StackPanel>

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

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