<userInterfaceElements:EvaWindow x:Class="Valg.EVA.Skanning.UserInterfaceElements.InstallClientCertificate.InstallClientCertificateWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:userInterfaceElements="clr-namespace:Valg.EVA.Skanning.UserInterfaceElements"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        mc:Ignorable="d" 
        xmlns:ui="clr-namespace:Valg.EVA.Skanning.UserInterfaceElements.InstallClientCertificate"
        d:DataContext="{d:DesignInstance d:Type=ui:InstallClientCertificateWindowViewModel}"
        WindowStartupLocation="CenterOwner"
        ShowInTaskbar="False"
        Style="{DynamicResource PopUpWindowAction}"
        Icon="{Binding WindowIcon}">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Valg.EVA.Skanning.Assets;component/ResourceDictionaries/ResourceLibrary.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <StackPanel Margin="30" Width="800" Height="300">

        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <TextBlock 
                Grid.Row="0" 
                Style="{StaticResource TextBlockLargeHeader}" 
                Text="{Binding LanguageString.InstallClientCertificate_HeaderText, FallbackValue='Install client sertificate'}"
                Margin="0,0,0,30">
            </TextBlock>
            <Border Grid.Row="1" Width="auto" Height="auto" Style="{StaticResource BlueBackgroundBorder}" Padding="20">
                <StackPanel Margin="10">
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100"/>
                            <ColumnDefinition />
                            <ColumnDefinition Width="200" />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition></RowDefinition>
                            <RowDefinition></RowDefinition>
                        </Grid.RowDefinitions>
                        <TextBlock Grid.Column="0" Grid.Row="0"
                            Style="{StaticResource TextBlockNormalWhite}" 
                            Text="{Binding LanguageString.InstallClientCertificate_PathText, FallbackValue='Certificate'}">
                        </TextBlock>
                        <TextBox Grid.Column="1" Grid.Row="0" 
                                 Style="{StaticResource TextBoxNormal}" 
                                 IsReadOnly="True" 
                                 Text="{Binding PathToClientCertificate, Mode=OneWay}"
                                 Width="400"/>
                        <Button Grid.Column="2" Grid.Row="0"
                                        Style="{StaticResource WhiteButtonBordered}"
                                        Command="{Binding SelectClientCertificateCommand}">
                            <Button.Content>
                                <TextBlock Text="{Binding LanguageString.InstallClientCertificate_BrowseForFileText, FallbackValue='Select Client Certificate'}" VerticalAlignment="Center" FontSize="16" />
                            </Button.Content>
                        </Button>
                        <TextBlock Grid.Column="0" Grid.Row="1" 
                            Margin="0,10,0,0"
                            Style="{StaticResource TextBlockNormalWhite}" 
                            Text="{Binding LanguageString.InstallClientCertificate_PasswordText, FallbackValue='Password'}">
                        </TextBlock>

                        <PasswordBox Grid.Column="1" Grid.Row="1" 
                            Margin="0,10,0,0"
                            Width="400"
                            Style="{StaticResource PasswordBoxNormal}"
                            x:Name="PasswordBox"
                            PasswordChanged="PasswordBox_OnPasswordChanged">
                        </PasswordBox>

                        <TextBox Grid.Column="1" Grid.Row="1" 
                            Margin="0,10,0,0"
                            Style="{StaticResource TextBoxNormal}"
                            x:Name="PasswordBoxShowCharacters"
                            Width="400"
                            Text="{Binding Password, ElementName=PasswordBox, Mode=TwoWay,  UpdateSourceTrigger=PropertyChanged}"
                            Visibility="Collapsed">
                        </TextBox>

                        <CheckBox Grid.Column="2" Grid.Row="1" 
                            Margin="0,10,0,0"
                            Style="{StaticResource WhiteCheckBox}"
                            x:Name="ShowPasswordCharsCheckBox" 
                            Content="{Binding LanguageString.InstallClientCertificate_ShowPasswordText}" 
                            Checked="ShowPasswordCharsCheckBox_Checked" 
                            Unchecked="ShowPasswordCharsCheckBox_Unchecked" />
                    </Grid>
                </StackPanel>
            </Border>

            <StackPanel Grid.Row="2" Orientation="Horizontal" Margin="0,30,0,0" HorizontalAlignment="Right">
                <TextBlock 
                    Style="{StaticResource CheckMarkIconGreen}" 
                    Visibility="{Binding ShowSuccessIcon, Converter={StaticResource BooleanToVisibilityConverter}}"
                    VerticalAlignment="Center"
                    Margin="0,0,10,0">
                </TextBlock>
                <TextBlock 
                    Style="{StaticResource CrossIconRed}" 
                    Visibility="{Binding ShowFailedIcon, Converter={StaticResource BooleanToVisibilityConverter}}"
                    VerticalAlignment="Center"
                    Margin="0,0,10,0">
                </TextBlock>
                <TextBlock 
                    Style="{StaticResource TextBlockNormal}" 
                    Text="{Binding InstallationResultInformation}"
                    VerticalAlignment="Center"
                    Margin="0,0,20,0">
                </TextBlock>
                <Button IsEnabled="{Binding IsReadyToInstall}"
                    Command="{Binding InstallClientCertificateCommand}"
                    Margin="0,0,0,0"
                    Style="{StaticResource BlueButtonOk}"
                    Content="{Binding LanguageString.InstallClientCertificate_Install_ButtonText, FallbackValue='Install'}"
                    Height="49"
                    Width="200"
                    IsDefault="True"/>
                <Button 
                    Style="{StaticResource BlueButton}"
                    MinWidth="150"
                    Height="49px"
                    TabIndex="0"
                    HorizontalAlignment="Right"
                    IsCancel="True"
                    Margin="20, 0, 0, 0"
                    Content="{Binding LanguageString.Button_Close, FallbackValue='Close'}">
                </Button>
            </StackPanel>
        </Grid>
    </StackPanel>
</userInterfaceElements:EvaWindow>
