<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 Brushes.TitleBar.Background}" >
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="auto"/>
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" >
                <Button Style="{StaticResource Styles.TitleBar.BackButton2}" Command="BrowseBack" />
                <TextBlock Style="{StaticResource Styles.TitleBar.Text}"  Text="控制器"/>
            </StackPanel>
            <local:CtMicroGage Grid.Column="1" x:Name="mircoGage" Background="Transparent" VerticalAlignment="Bottom"/>
        </Grid>
        <ScrollViewer CanContentScroll="True" PanningMode="Both" Grid.Row="1" >
            <StackPanel Margin="{StaticResource ControlMargin}">
                <Border Style="{StaticResource Styles.Card.Border}">
                    <StackPanel>
                        <TextBlock Style="{StaticResource Styles.Card.Title}"
                                   Text="参数"/>
                        <StackPanel >
                            <StackPanel Margin="{StaticResource ControlMargin}">
                                <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="IP地址:端口" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding EP, Converter={StaticResource ipepconv}}" Tag="Full"  />
                                </StackPanel>
                            </StackPanel>
                            <WrapPanel Orientation="Horizontal">
                                <StackPanel Margin="{StaticResource ControlMargin}">
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="CRC" />
                                    <ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding HasCRC}"/>
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}">
                                    <TextBlock Style="{StaticResource ResourceKey=Styles.Text.FieldHeader.Editable}" Text="不使用AD盒速度" />
                                    <ToggleButton Style="{StaticResource Styles.ToggleButton.YESNO}" IsChecked="{Binding IsCalSpeed}" HorizontalAlignment="Left"/>
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}" >
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="脉冲/数据格" />
                                    <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding PosOfGrid}" />
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}" >
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="数据平滑" />
                                    <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding GridSmooth}" />
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}">
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="电机类型" />
                                    <ComboBox Width="191" HorizontalAlignment="Left" MinHeight="40">

                                        <ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.SERVO}}">
                                            <TextBlock Style="{StaticResource Styles.Text.FieldContent}"  FontSize="32" Text="伺服"/>
                                        </ComboBoxItem>
                                        <ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.VF0}}" >
                                            <TextBlock Style="{StaticResource Styles.Text.FieldContent}"  FontSize="32" Text="变频器"/>
                                        </ComboBoxItem>
                                        <ComboBoxItem IsSelected="{Binding MotorType, Converter={StaticResource e2bconv}, ConverterParameter={x:Static common:MOTORTYPE.NULL}}" >
                                            <TextBlock Style="{StaticResource Styles.Text.FieldContent}"  FontSize="32" Text="无"/>
                                        </ComboBoxItem>
                                    </ComboBox>
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}">
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="电机脉冲" />
                                    <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding Ratio01}" />
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}">
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="编码脉冲" />
                                    <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding Ratio02}" />
                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}">
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="原点位置" />
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding PosOffset}" />
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="脉冲"/>
                                    </StackPanel>

                                </StackPanel>
                                <StackPanel Margin="{StaticResource ControlMargin}">
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="JOG速度" />
                                    <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding JogVelocity}" />
                                </StackPanel>
                                <StackPanel  Margin="{StaticResource ControlMargin}" >
                                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="AD延时" />
                                    <StackPanel Orientation="Horizontal">
                                        <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding ADLag}" HorizontalAlignment="Left"/>
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="*1.28ms"/>
                                    </StackPanel>
                                </StackPanel>
                            </WrapPanel>
                            <StackPanel>
                                <Button Style="{StaticResource ButtonStyle_apply}" VerticalAlignment="Bottom" Margin="0,0,20,20" 
                                        Command="{Binding ApplyCmd}"/>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </Border>
                <Border Style="{StaticResource Styles.Card.Border}">
                    <StackPanel>
                        <TextBlock Style="{StaticResource Styles.Card.Title}"
                                   Text="动作"/>
                        <StackPanel Orientation="Horizontal">
                            <Button Style="{StaticResource Styles.Button.Square2}" Content="反行" Command="{Binding BackwCmd}"/>
                            <Button Style="{StaticResource Styles.Button.Square2}" Content="正行" Command="{Binding ForwCmd}" />
                            <Button Style="{StaticResource Styles.Button.Square2}" Content="归零" Command="{Binding OrgCmd}" />
                            <Button Style="{StaticResource Styles.Button.Square.Accent2}" Background="{StaticResource Brushes.Validation}" Content="停止" Command="{Binding StopCmd}" />
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Button Style="{StaticResource Styles.Button.Square.Accent2}" Content="运行至" Command="{Binding BackwCmd}"/>
                            <StackPanel  Margin="{StaticResource ControlMargin}" >
                                <TextBlock Style="{StaticResource Styles.Text.FieldHeader.Editable}" Text="目标位置" />
                                <StackPanel Orientation="Horizontal">
                                    <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding TargetPos}" HorizontalAlignment="Left"/>
                                    <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="脉冲"/>
                                </StackPanel>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </Border>

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