<Window x:Class="FasdDesktopUi.Pages.M42AuthenticationPage.F4sdM42FormsAuthentication"
             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:vc="clr-namespace:FasdDesktopUi.Basics.Converter"
             xmlns:local="clr-namespace:FasdDesktopUi.Pages.M42AuthenticationPage"
             xmlns:ico="clr-namespace:FasdDesktopUi.Basics.UserControls.AdaptableIcon;assembly=F4SD-AdaptableIcon"
             xmlns:WebView="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
             mc:Ignorable="d" 
             Title="M42FomsAuthetication"
             ResizeMode="CanResizeWithGrip"
             WindowStyle="None"
             AllowsTransparency="True"
             Background="Transparent"
             MinHeight="800"
             MinWidth="800"
             ShowInTaskbar="False"
             Topmost="True"
             SizeToContent="WidthAndHeight"
             WindowStartupLocation="CenterScreen"
             d:DesignHeight="450"
             d:DesignWidth="800"
             x:Name="F4sdM42FormsAuth"
        >
    <Window.Resources>
        <vc:LanguageDefinitionsConverter x:Key="LanguageConverter" />
    </Window.Resources>
    <Border
        CornerRadius="10"
        Background="{DynamicResource BackgroundColor.Menu.Categories}"
        Padding="10"
        >
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="auto"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                    <ColumnDefinition Width="auto"/>
                </Grid.ColumnDefinitions>
                <TextBlock x:Name="TextHeader" x:FieldModifier="private" Text="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.FormsAuthentication.Header}" FontSize="18" VerticalAlignment="Center" Margin="10 0 0 0" FontWeight="Bold"/>
                <ico:AdaptableIcon
                               x:Name="butRefresh"
                               Grid.Column="1"
                               SelectedInternIcon="menuBar_refresh"
                               Padding="0" Margin="4 2"
                               IconHeight="30" IconWidth="30"
                               Style="{DynamicResource SettingsPage.Close.Icon}"
                               HorizontalAlignment="Center" VerticalAlignment="Center"
                               Background="#01000000"
                               MouseLeftButtonUp="butRefresh_MouseLeftButtonUp"
                               Cursor="Hand"
                               ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.Header.RefreshForm}"
                    />
                <ico:AdaptableIcon
                               x:Name="butClearCookies"
                               Grid.Column="2"
                               SelectedMaterialIcon="ic_delete_forever"
                               Padding="0" Margin="4 2"
                               Style="{DynamicResource SettingsPage.Close.Icon}"
                               IconHeight="30" IconWidth="30"
                               HorizontalAlignment="Center" VerticalAlignment="Center"
                               Background="#01000000"
                               MouseLeftButtonUp="butClearCookies_MouseLeftButtonUp"
                               ToolTip="{Binding Converter={StaticResource LanguageConverter}, ConverterParameter=M42Settings.Header.ClearCookies}"
                               />
                <ico:AdaptableIcon Grid.Column="3"
                               SelectedInternIcon="window_close"
                               Padding="0" Margin="4 2"
                               Style="{DynamicResource SettingsPage.Close.Icon}"
                               IconHeight="30"
                               IconWidth="30"
                               HorizontalAlignment="Center"
                               VerticalAlignment="Center"
                               Background="#01000000"
                               MouseLeftButtonUp="CloseIcon_MouseLeftButtonUp"
                               />
            </Grid>

            <Border Grid.Row="1"
                    CornerRadius="7.5"
                    Background="{DynamicResource BackgroundColor.Menu.MainCategory}"
                >
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="249*"/>
                        <ColumnDefinition Width="11*"/>
                    </Grid.ColumnDefinitions>

                    <WebView:WebView2
                        x:Name="WebLogon" x:FieldModifier="private"
                        Loaded="WebLogon_Loaded"
                        NavigationStarting="WebLogon_NavigationStarting"
                        Margin="10,10,10,10"
                        Grid.ColumnSpan="2"
                        />
                    <Border
                            x:Name="NoAccessTokenMessage" x:FieldModifier="private"
                            Margin="197,0,0,0"
                            HorizontalAlignment="Left" VerticalAlignment="Center"
                            Background="{DynamicResource BackgroundColor.Menu.Categories}"
                            CornerRadius="7.5"
                        >
                        <TextBlock
                                FontSize="20"
                                Foreground="Red"
                                TextWrapping="WrapWithOverflow"
                                Margin="10"
                                Text="Could not get a valid authorisation token."
                             />
                    </Border>
                </Grid>
            </Border>
        </Grid>
    </Border>
</Window>
