<Window x:Class="Flyad7_WPF.WdCreateAccess"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:Flyad7_WPF" 
        xmlns:conv="clr-namespace:Flyad7_WPF.Converters"
        mc:Ignorable="d"
        Title="WdCreateAccess" Height="325.4" Width="569.8">
    <Window.Resources>
        <conv:BytesConverter x:Key="bytesconv"/>


        <Style TargetType="TextBlock" x:Key="Styles.Text.ItemTitle" BasedOn="{StaticResource Styles.Text.FieldHeader}">
            <Setter Property="Width" Value="60" />
        </Style>
    </Window.Resources>
    <Grid>
        <StackPanel Margin="5" HorizontalAlignment="Center" VerticalAlignment="Center">
            <StackPanel Orientation="Horizontal">
                <TextBlock Style="{StaticResource Styles.Text.ItemTitle}" Text="序列码"/>
                <TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding Code, Converter={StaticResource bytesconv}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Style="{StaticResource Styles.Text.ItemTitle}" Text="授权码"/>
                <TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding Access, Converter={StaticResource bytesconv}}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <TextBlock Style="{StaticResource Styles.Text.ItemTitle}" Text="使用时间"/>
                <TextBox Style="{StaticResource Styles.Text.FieldContent.Input}" Text="{Binding Hours}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal">
                <Button Style="{StaticResource Styles.Button.Square2}" Command="{Binding CreateAccessCmd}" Content="获取"/>
                <Button Style="{StaticResource Styles.Button.Square2}" Command="{Binding CheckAccessCmd}" Content="检测"/>
                <Button Style="{StaticResource Styles.Button.Square2}" Command="{Binding InitCodeCmd}" Content="初始化"/>
                <Button Style="{StaticResource Styles.Button.Square2}" Command="{Binding SetAccessCmd}" Content="写入AD盒"/>
                <StackPanel Orientation="Horizontal">
                    <TextBlock>成功写入</TextBlock>
                    <TextBlock Padding="10,2" Margin="1" FontSize="20" Foreground="White" Background="Green" Text="{Binding SuccessCnt,Mode=OneWay}"/>
                    <TextBlock>次</TextBlock>
                </StackPanel>
            </StackPanel>
            <TextBlock Text="{Binding Message}"/>
            <StackPanel Orientation="Horizontal">
                <TextBlock Style="{StaticResource Styles.Text.IsConnected}" Tag="{Binding IsConnected}"/>

                <Button Style="{StaticResource Styles.Button.Square2}" Command="{Binding ReConnectCmd}" Content="重连" IsEnabled="{Binding IsEnableReConnect}"/>

                <Button Style="{StaticResource Styles.Button.Square2}" Command="{Binding InitCodeAutoCmd}" Content="初始化序列码，写入授权码"/>

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