<UserControl x:Class="HistoryView.Views.Login"
             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:HistoryView.Views"
             xmlns:prism="http://prismlibrary.com/"
             xmlns:pass="clr-namespace:HistoryView.Helper"
             xmlns:Inputs="clr-namespace:HistoryView.Controls.Input"
             prism:ViewModelLocator.AutoWireViewModel="True"
                   xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
             mc:Ignorable="d" >
    <Grid Background="AliceBlue">
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="320"/>
            <ColumnDefinition Width="*"/>
        </Grid.ColumnDefinitions>

        <Image Grid.ColumnSpan="3" Opacity="0.5" Stretch="UniformToFill" HorizontalAlignment="Left" Margin="-400,0,0,0" Source="pack://application:,,,/Resources/BackGround.png"/>

        <Border Grid.Column="1" CornerRadius="8" Background="{StaticResource BackgroundDarkColor}" VerticalAlignment="Center">
            <Grid Margin="32" VerticalAlignment="Center" TextElement.FontSize="14" TextElement.Foreground="{StaticResource TextColor}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="32"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="24"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="8"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="24"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="24"/>
                    <RowDefinition Height="auto"/>

                </Grid.RowDefinitions>

                <Image Source="pack://application:,,,/Resources/jetplasmalogo.png" Height="64"/>

                <Border Grid.Row="2" Background="#50000000" CornerRadius="15" Height="30">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{StaticResource Icon_User}" Height="16" Margin="10,0"/>
                        <Inputs:TextboxKeyboard Text="{Binding UserInfo.UserName, Mode=TwoWay}" DirectInput="True">
                            <Inputs:TextboxKeyboard.DisplayContent>
                                <TextBox Height="30" VerticalContentAlignment="Center" Width="180" FontSize="12" Foreground="{StaticResource TextColor}" BorderBrush="Transparent" BorderThickness="0" Background="Transparent" GotFocus="User_GotFocus" LostFocus="User_LostFocus" Text="{Binding UserInfo.UserName,Mode=TwoWay}"/>
                            </Inputs:TextboxKeyboard.DisplayContent>
                        </Inputs:TextboxKeyboard>
                    </StackPanel>
                </Border>

                <Border Grid.Row="4" Background="#50000000" CornerRadius="15" Height="30">
                    <StackPanel Orientation="Horizontal">
                        <Image Source="{StaticResource Icon_Lock}" Height="16" Margin="10,0"/>
                        <Inputs:TextboxKeyboard Text="{Binding UserInfo.Password, Mode=TwoWay}" DirectInput="True">
                            <Inputs:TextboxKeyboard.DisplayContent>
                                <PasswordBox  Height="30" VerticalContentAlignment="Center" Width="180" FontSize="12" Foreground="{StaticResource TextColor}" BorderBrush="Transparent" BorderThickness="0" Background="Transparent" pass:PassWordExtensions.PassWord="{Binding UserInfo.Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
                                    <i:Interaction.Behaviors>
                                        <pass:PasswordBehavior/>
                                    </i:Interaction.Behaviors>
                                </PasswordBox>
                            </Inputs:TextboxKeyboard.DisplayContent>
                        </Inputs:TextboxKeyboard>

                    </StackPanel>
                </Border>

                <TextBlock Grid.Row="6" Height="auto" Foreground="{StaticResource TextColor}"  Text="{Binding Hint, Mode=TwoWay}"/>

                <Button Grid.Row="8" Style="{StaticResource LoginButton}" Command="{Binding LoginCommand}" Height="32" IsDefault="True">
                    <TextBlock Foreground="{StaticResource TextColor}">
                        <Run Text="{DynamicResource Login}"></Run>
                        <Run>-></Run>
                    </TextBlock>
                </Button>

                <Button Grid.Row="10" Style="{StaticResource ClearButton}" Background="Transparent" Command="{Binding ReadOnlyLoginCommand}" Height="32">
                    <TextBlock Foreground="{StaticResource TextColor}" TextWrapping="Wrap" HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Run Text="{DynamicResource LoginWithDisplayMode}"></Run>
                        <Run>-></Run>
                    </TextBlock>
                </Button>


            </Grid>
        </Border>

        <StackPanel Orientation="Horizontal" Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Right" Margin="32">
            <Image Source="{StaticResource Language}" VerticalAlignment="Center" Height="24"/>
            <Image Source="{DynamicResource LanguageFlag}" Margin="16,0" VerticalAlignment="Center" Height="24"/>
            <ComboBox Grid.Column="2" MinWidth="100" ItemsSource="{Binding LanguageLoader.Languages}" DisplayMemberPath="Key" SelectedItem="{Binding LanguageLoader.SelectedLanguage, Mode=TwoWay}"/>
        </StackPanel>
    </Grid>
</UserControl>
