<UserControl x:Class="NebulaAuth.View.Dialogs.LoginAgainOnImportDialog"
             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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             xmlns:other="clr-namespace:NebulaAuth.ViewModel.Other"
             xmlns:model="clr-namespace:NebulaAuth.Model"
             xmlns:entities="clr-namespace:NebulaAuth.Model.Entities"
             mc:Ignorable="d"
             TextElement.Foreground="{DynamicResource BaseContentBrush}"
             d:DataContext="{d:DesignInstance other:LoginAgainVM}"
             Background="{DynamicResource WindowBackground}">

    <Grid MinHeight="160" MinWidth="350">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid Margin="10,10,10,5">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal">
                <materialDesign:PackIcon Kind="Login" Width="20" Height="20" Margin="0,0,5,0"
                                         VerticalAlignment="Center"
                                         Foreground="{DynamicResource PrimaryContentBrush}" />
                <TextBlock FontSize="16" VerticalAlignment="Center" Foreground="{DynamicResource BaseContentBrush}"
                           Margin="7,0,0,0" HorizontalAlignment="Left">
                    <Run Text="{Tr LoginAgainDialog.LoginFor, IsDynamic=False}" />
                    <Run FontWeight="Bold" Text="{Binding UserName}" />
                </TextBlock>
            </StackPanel>
            <Button Grid.Column="1" Width="30" Height="30" Style="{StaticResource MaterialDesignIconForegroundButton}"
                    HorizontalAlignment="Right" CommandParameter="{StaticResource False}"
                    Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}">
                <materialDesign:PackIcon Kind="Close" Width="24" Height="24" Foreground="IndianRed" />

            </Button>
        </Grid>
        <Separator Grid.Row="1" Opacity="0.7" />
        <Grid Grid.Row="2" Margin="12">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <TextBox TabIndex="0" Text="{Binding Password, UpdateSourceTrigger=PropertyChanged}"

                     materialDesign:TextFieldAssist.HasClearButton="True"
                     Padding="10"
                     FontSize="15"
                     Margin="10,10,10,0"
                     Grid.Row="0"
                     Style="{StaticResource MaterialDesignOutlinedTextBox}"

                     materialDesign:HintAssist.Hint="{Tr LoginAgainDialog.PasswordBox}"
                     materialDesign:HintAssist.IsFloating="False"
                     materialDesign:TextFieldAssist.LeadingIcon="Key"
                     materialDesign:TextFieldAssist.HasLeadingIcon="True" />
            <ComboBox Grid.Row="1" FontSize="15" ToolTip="{Tr LoginAgainDialog.ProxyToolTip}" Margin="10,18,10,0"
                      materialDesign:HintAssist.Hint="{Tr Common.Proxy}" ItemsSource="{Binding Proxies}"
                      SelectedItem="{Binding SelectedProxy}">
                <ItemsControl.ItemTemplate>
                    <DataTemplate DataType="{x:Type entities:MaProxy}">
                        <TextBlock Text="{Binding Converter={StaticResource ProxyTextConverter}, Mode=OneWay}" />
                    </DataTemplate>
                </ItemsControl.ItemTemplate>
                <UIElement.InputBindings>
                    <KeyBinding Key="Delete" Command="{Binding RemoveProxyCommand}" />
                </UIElement.InputBindings>
            </ComboBox>
            <CheckBox FontSize="15" Grid.Row="2" Margin="10,5,10,0"
                      IsEnabled="{Binding Source={x:Static model:PHandler.IsPasswordSet}}"
                      IsChecked="{Binding SavePassword}" Content="{Tr LoginAgainDialog.SaveEncryptedPassword}" />
            <CheckBox FontSize="15" Grid.Row="3" Margin="10,5,10,0" IsEnabled="{Binding  MafileHasProxy}"
                      Content="{Tr LoginAgainDialog.UseMafileProxy}" IsChecked="{Binding UseMafileProxy}" />
            <Grid Grid.Row="4" Margin="10,10,10,0">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition />
                    <ColumnDefinition />
                </Grid.ColumnDefinitions>
                <Button IsEnabled="{Binding IsFormValid}" IsDefault="True" Margin="0,5,5,5"
                        Style="{StaticResource MaterialDesignOutlinedButton}"
                        Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
                        CommandParameter="{StaticResource True}" Content="{Tr LoginAgainDialog.LoginButton}" />
                <Button IsCancel="True" Grid.Column="1" Margin="5,5,0,5"
                        Style="{StaticResource MaterialDesignOutlinedButton}"
                        Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}"
                        CommandParameter="{StaticResource False}" Content="{Tr LoginAgainDialog.CancelButton}" />
            </Grid>
        </Grid>
    </Grid>
</UserControl>