<Page x:Class="FLY.Thick.Blowing.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:baseUi="clr-namespace:FLY.Thick.Base.UI;assembly=FLY.Thick.Base.UI"
      xmlns:local="clr-namespace:FLY.Thick.Blowing.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>
            <Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldContent.Unit}" x:Key="Styles.Text.FieldContent.Error">
                <Setter Property="Foreground" Value="{StaticResource Brushes.Validation}"/>
            </Style>
        </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="AD盒" />
            </StackPanel>
        </Grid>
        <ScrollViewer PanningMode="Both" Grid.Row="1" >
            <StackPanel Margin="{StaticResource ControlMargin}">
                <Border Style="{StaticResource Styles.Card.Border}">
                    <StackPanel>
                        <TextBlock Style="{StaticResource Styles.Card.Title}"
                                   Text="AD盒参数"/>
                        <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 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="AD盒版本" />
                                    <StackPanel Orientation="Horizontal">
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="v"/>
                                        <TextBox Style="{StaticResource Styles.Text.FieldContent.Input.Card}" Text="{Binding HardwareVersion}" />
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Separator}"/>
                                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}">
                                            通讯版本:v<Run Text="{Binding Version}"/>
                                        </TextBlock>
                                    </StackPanel>
                                </StackPanel>
                            </WrapPanel>
                            <StackPanel Orientation="Horizontal" FlowDirection="RightToLeft">
                                <Button Style="{StaticResource Styles.Button.Square.Accent2}" Content="应用" Command="{Binding ApplyCmd}"/>
                            </StackPanel>
                        </StackPanel>
                    </StackPanel>
                </Border>

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