<Page x:Class="FLY.Thick.FilmCasting.UI.Server.PgMain"
      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.FilmCasting.UI.Server"
      mc:Ignorable="d" 
      Background="White"
      Title="PgMain">
    <Page.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Themes/Styles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <local:ConnectionValueConverter x:Key="connectionConv"/>
        </ResourceDictionary>
    </Page.Resources>
    <Grid >
        <StackPanel>
            <StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}">
                <Button Style="{StaticResource Styles.Button.Square.Accent2}" 
                        Content="设置" Command="{Binding SetupCmd}"/>
                <Button Style="{StaticResource Styles.Button.Square.Accent2}" Width="auto" 
                        Content="图片数据" Command="{Binding PicSetupCmd}"/>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}" >
                <StackPanel Margin="{StaticResource ControlMargin}" DataContext="{Binding SysParam}">
                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="服务地址"/>
                    <TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding Addr}"/>
                </StackPanel>
                <StackPanel Margin="{StaticResource ControlMargin}" DataContext="{Binding InitParam}">
                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="数据库路径"/>
                    <TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding DbDirPath}"/>
                </StackPanel>
                <StackPanel Margin="{StaticResource ControlMargin}" DataContext="{Binding InitParam}">
                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="数据库保存时间"/>
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding DBKeepMonth}"/>
                        <TextBlock Style="{StaticResource Styles.Text.FieldContent.Unit}" Text="月"/>
                    </StackPanel>
                </StackPanel>
            </StackPanel>
            <StackPanel Orientation="Horizontal" Margin="{StaticResource ControlMargin}" DataContext="{Binding FlyAd}">
                <StackPanel Margin="{StaticResource ControlMargin}">
                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="AD盒地址"/>
                    <TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding Addr}"/>
                </StackPanel>
                <StackPanel Margin="{StaticResource ControlMargin}">
                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="AD盒状态"/>
                    <TextBlock Text="{Binding IsConnected,Converter={StaticResource connectionConv}}">
                        <TextBlock.Style>
                            <Style TargetType="TextBlock" BasedOn="{StaticResource Styles.Text.FieldContent}">
                                <Setter Property="Foreground" Value="Red"/>
                                <Style.Triggers>
                                    <DataTrigger Binding="{Binding IsConnected}" Value="True">
                                        <Setter Property="Foreground" Value="Green"/>
                                    </DataTrigger>
                                </Style.Triggers>
                            </Style>
                        </TextBlock.Style>
                    </TextBlock>
                </StackPanel>
                <StackPanel Margin="{StaticResource ControlMargin}">
                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="AD值"/>
                    <TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding AD}"/>
                </StackPanel>
                <StackPanel Margin="{StaticResource ControlMargin}">
                    <TextBlock Style="{StaticResource Styles.Text.FieldHeader}" Text="脉冲"/>
                    <TextBlock Style="{StaticResource Styles.Text.FieldContent}" Text="{Binding Position}"/>
                </StackPanel>
            </StackPanel>
        </StackPanel>
    </Grid>
</Page>
