<Page
    x:Class="YMhut.Box.WinUI.Views.SafeBrowserPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:Microsoft.UI.Xaml.Controls">
    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <Border Margin="24,20,24,12" CornerRadius="24" Padding="16" Background="{ThemeResource CardBackgroundFillColorDefaultBrush}">
            <Grid ColumnSpacing="12" RowSpacing="10">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>

                <StackPanel Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
                    <Button x:Name="BackButton" Content="后退" Click="BackButton_Click" />
                    <Button x:Name="ForwardButton" Content="前进" Click="ForwardButton_Click" />
                    <Button Content="主页" Click="HomeButton_Click" />
                    <Button x:Name="RefreshButton" Content="刷新" Click="RefreshButton_Click" />
                </StackPanel>

                <StackPanel Grid.Column="1" Spacing="4">
                    <TextBlock Text="安全浏览器" FontSize="18" FontWeight="SemiBold" />
                    <AutoSuggestBox
                        x:Name="AddressBox"
                        PlaceholderText="输入网址或搜索关键词"
                        QuerySubmitted="AddressBox_QuerySubmitted" />
                </StackPanel>

                <StackPanel Grid.Column="2" Orientation="Horizontal" Spacing="8" VerticalAlignment="Center">
                    <Button Content="外部打开" Click="ExternalButton_Click" />
                    <Button Content="重置缩放" Click="ResetZoomButton_Click" />
                </StackPanel>
            </Grid>
        </Border>

        <Grid Grid.Row="1" Margin="24,0,24,24">
            <Border CornerRadius="24" BorderThickness="1" BorderBrush="{ThemeResource CardStrokeColorDefaultBrush}" Background="#FF111111">
                <controls:WebView2
                    x:Name="Browser"
                    NavigationStarting="Browser_NavigationStarting"
                    NavigationCompleted="Browser_NavigationCompleted" />
            </Border>
            <ProgressBar x:Name="LoadingBar" VerticalAlignment="Top" Height="3" IsIndeterminate="True" Visibility="Collapsed" />
        </Grid>
    </Grid>
</Page>
