<UserControl x:Class="VIZ.Package.Module.LoginView"
             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:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
             xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
             xmlns:dxe="http://schemas.devexpress.com/winfx/2008/xaml/editors"
             xmlns:local="clr-namespace:VIZ.Package.Module"
             mc:Ignorable="d" 
             d:DataContext="{d:DesignInstance Type=local:LoginViewModel}" 
             d:Background="White"
             d:DesignHeight="580" d:DesignWidth="500">


    <UserControl.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/VIZ.Package.Module.Resource;component/Style/Button/Button_Default.xaml"></ResourceDictionary>
            </ResourceDictionary.MergedDictionaries>

        </ResourceDictionary>
    </UserControl.Resources>

    <dxmvvm:Interaction.Behaviors>
        <dxmvvm:EventToCommand EventName="Loaded" Command="{Binding Path=LoadedCommand}"></dxmvvm:EventToCommand>
    </dxmvvm:Interaction.Behaviors>

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="200"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <!-- Logo -->
        <Grid Margin="10,10,10,20">
            <Grid.RowDefinitions>
                <RowDefinition Height="*"></RowDefinition>
                <RowDefinition Height="50"></RowDefinition>
            </Grid.RowDefinitions>
            <Image HorizontalAlignment="Center" Width="114" Height="114"
                   Source="/VIZ.Package.Module.Resource;component/Images/login_large2.png"></Image>
            <TextBlock Text="摩羯座播控系统" Grid.Row="1" VerticalAlignment="Center" 
                       HorizontalAlignment="Center" FontSize="24"></TextBlock>
        </Grid>
        <!-- 功能区 -->
        <Grid Grid.Row="1">
            <Grid.RowDefinitions>
                <RowDefinition Height="45"></RowDefinition>
                <RowDefinition Height="45"></RowDefinition>
                <RowDefinition Height="45"></RowDefinition>
                <RowDefinition Height="45"></RowDefinition>
                <RowDefinition Height="45"></RowDefinition>
                <RowDefinition Height="45"></RowDefinition>
                <RowDefinition Height="45"></RowDefinition>
                <RowDefinition Height="55"></RowDefinition>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="120"></ColumnDefinition>
                <ColumnDefinition Width="*"></ColumnDefinition>
                <ColumnDefinition Width="100"></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <!-- 引擎 -->
            <TextBlock Text="引擎:" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
            <dxe:ComboBoxEdit Grid.Row="0" Grid.Column="1" Height="30" IsTextEditable="False"
                              ItemsSource="{Binding Path=EngineFullTypes}"
                              SelectedItem="{Binding Path=SelectedEngineFullType,Mode=TwoWay}" 
                              DisplayMember="Description">
            </dxe:ComboBoxEdit>

            <!-- 引擎模式 -->
            <TextBlock Text="预览模式:" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
            <dxe:ComboBoxEdit Grid.Row="1" Grid.Column="1" Height="30" IsTextEditable="False"
                              ItemsSource="{Binding Path=EnginePreviewModes}"
                              SelectedItem="{Binding Path=SelectedEnginePreviewMode,Mode=TwoWay}" 
                              DisplayMember="Description">
            </dxe:ComboBoxEdit>

            <!-- 节目 -->
            <TextBlock Text="节目:" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
            <dxe:ComboBoxEdit Grid.Row="2" Grid.Column="1" Height="30" IsTextEditable="False"
                              ItemsSource="{Binding Path=PluginGroups}"
                              SelectedItem="{Binding Path=SelectedPluginGroup,Mode=TwoWay}">
            </dxe:ComboBoxEdit>

            <!-- IP -->
            <TextBlock Text="IP:" Grid.Row="3" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
            <dxe:TextEdit Grid.Row="3" Grid.Column="1" Height="30"
                          EditValue="{Binding GH_IP,Mode=TwoWay}"></dxe:TextEdit>

            <!-- ServerName -->
            <TextBlock Text="服务名:" Grid.Row="4" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
            <dxe:ComboBoxEdit Grid.Row="4" Grid.Column="1" Height="30" IsTextEditable="False"
                              ItemsSource="{Binding Path=GH_ServerName_List}"
                              SelectedItem="{Binding Path=GH_ServerName,Mode=TwoWay}">
            </dxe:ComboBoxEdit>

            <!-- UserName -->
            <TextBlock Text="用户名:" Grid.Row="5" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
            <dxe:ComboBoxEdit Grid.Row="5" Grid.Column="1" Height="30" IsTextEditable="False"
                              ItemsSource="{Binding Path=VIZ_UserName_List}"
                              SelectedItem="{Binding Path=VIZ_UserName,Mode=TwoWay}">
            </dxe:ComboBoxEdit>

            <!-- Password -->
            <TextBlock Text="密码:" Grid.Row="6" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="0,0,10,0"></TextBlock>
            <dxe:TextEdit Grid.Row="6" Grid.Column="1" Height="30"
                          EditValue="{Binding VIZ_Password,Mode=TwoWay}"></dxe:TextEdit>

            <!-- 按钮组 -->
            <Button Grid.Row="7" Height="40" Grid.Column="1" Content="登录"  HorizontalAlignment="Stretch"
                    Style="{StaticResource Button_Main}"
                    Command="{Binding Path=LoginCommand}"></Button>
        </Grid>

        <dx:WaitIndicator DeferedVisibility="{Binding IsLoading}" Content="Loading..." Grid.RowSpan="2" />
    </Grid>
</UserControl>
