<ContentDialog
    x:Class="Bili.SignIn.Workspace.SignInDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:local="using:Bili.SignIn.Workspace"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    Title="{local:Locale Name=SignInTitle}"
    Style="{StaticResource DefaultContentDialogStyle}"
    CloseButtonClick="OnCloseButtonClick"
    CloseButtonText="{local:Locale Name=Cancel}"
    DefaultButton="Primary"
    mc:Ignorable="d">

    <Grid Width="320">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Grid ColumnSpacing="8">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock
                x:Name="TipBlock"
                Style="{StaticResource CaptionTextBlockStyle}"
                Margin="0,0,0,8"
                HorizontalAlignment="Left"
                VerticalAlignment="Center"
                Opacity="0.7"
                Text="{local:Locale Name=QRLoginTip}"
                TextWrapping="Wrap" />
        </Grid>

        <Grid
            x:Name="QRLoginContainer"
            Grid.Row="2"
            Margin="0,8,0,0"
            RowSpacing="4">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid MinHeight="200" CornerRadius="{StaticResource ControlCornerRadius}">
                <Viewbox HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
                    <Image
                        x:Name="QRCodeImage"
                        HorizontalAlignment="Stretch"
                        VerticalAlignment="Stretch"
                        Stretch="Uniform" />
                </Viewbox>

                <Grid
                    x:Name="QRMaskContainer"
                    Background="{ThemeResource ContentDialogSmokeFill}"
                    Visibility="Collapsed">
                    <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
                        <TextBlock
                            x:Name="QRTipBlock"
                            Style="{StaticResource BodyTextBlockStyle}"
                            MaxWidth="150"
                            HorizontalAlignment="Center"
                            TextAlignment="Center"
                            TextWrapping="Wrap" />
                    </StackPanel>
                </Grid>

                <ProgressRing
                    x:Name="QRLoadingRing"
                    Width="24"
                    Height="24"
                    HorizontalAlignment="Center"
                    VerticalAlignment="Center"
                    IsActive="False" />
            </Grid>
            <HyperlinkButton
                x:Name="RefreshQRButton"
                Style="{StaticResource DefaultHyperlinkButtonStyle}"
                Grid.Row="1"
                HorizontalAlignment="Stretch"
                Click="OnRefreshQRButtonClickAsync"
                Content="{local:Locale Name=Refresh}" />
        </Grid>
    </Grid>

</ContentDialog>
