<Window x:Class="极简浏览器.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:external="clr-namespace:极简浏览器.External"
        Title="极简浏览器"
        Style="{StaticResource ModernWindow}"
        Background="#AAFFFFFF"
        external:WindowBlur.IsEnabled="True"
        Closing="WindowClosing"
        Icon="/Icon/Icon.ico"
        KeyDown="GoShortcut"
        Loaded="WindowLoaded">
    <WindowChrome.WindowChrome>
        <WindowChrome GlassFrameThickness="0 64 0 0" NonClientFrameEdges="Left,Bottom,Right" />
    </WindowChrome.WindowChrome>
    <Grid x:Name="MainGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <DockPanel Background="Transparent">
            <DockPanel.Effect>
                <DropShadowEffect Opacity="0.2" Direction="270" />
            </DockPanel.Effect>
            <Button x:Name="GoBackButton"
                    Margin="8,8,4,8"
                    Style="{StaticResource NavButton}"
                    Click="GoBackClick" Content="&#xE72B;" />
            <Button x:Name="GoForwardButton"
                    Style="{StaticResource NavButton}"
                    Click="GoForwardClick" Content="&#xE72A;" />
            <Button x:Name="SubmenuButton"
                    DockPanel.Dock="Right"
                    Margin="4,8,8,8"
                    Style="{StaticResource NavButton}"
                    Click="SubmenuClick" Content="&#xE712;" />
            <Button x:Name="NewPageButton"
                    DockPanel.Dock="Right"
                    Style="{StaticResource NavButton}"
                    Click="NewPageClick" Content="&#xE710;" />
            <Button x:Name="RefershButton"
                    DockPanel.Dock="Right"
                    Style="{StaticResource NavButton}"
                    Click="RefreshClick" Content="&#xE72C;" />
            <TextBox x:Name="AddressBox"
                     Margin="4" VerticalAlignment="Center"
                     Style="{StaticResource TextboxStyle}"
                     KeyDown="PageCheckUrl" TextWrapping="NoWrap" />
        </DockPanel>
        <Popup x:Name="SubmenuPopup"
               AllowsTransparency="True" Focusable="False" Placement="Left"
               PlacementTarget="{Binding ElementName=SubmenuButton}"
               PopupAnimation="Slide" StaysOpen="False">
            <Border BorderBrush="#DADCE0" BorderThickness="2">
                <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                    <StackPanel Background="White" KeyboardNavigation.DirectionalNavigation="Cycle">
                        <MenuItem Header="后退" Click="GoForwardClick" />
                        <MenuItem Header="前进" Click="GoBackClick" />
                        <MenuItem Header="刷新" Click="RefreshClick" />
                        <MenuItem Header="查找" Click="ShowSearchBox" />
                        <MenuItem Header="新窗口" Click="NewPageClick" />
                        <MenuItem Header="网页源代码" Click="ViewSourceClick" />
                        <MenuItem Header="设为书签" Click="SetBookMarkClick" />
                        <MenuItem Header="历史记录/书签" Click="HistoryClick" />
                        <MenuItem Header="设置" Click="SettingClick" />
                        <MenuItem Header="帮助" Click="HelpClick" />
                        <MenuItem Header="关于" Click="AboutClick" />
                        <MenuItem Header="开发者工具" Click="DevToolsClick" />
                        <MenuItem Header="置顶"
                                  Click="TopmostClick" IsCheckable="True"
                                  IsChecked="{Binding Args.Topmost, Mode=OneWayToSource}" />
                        <MenuItem x:Name="singleBox" Header="本窗口打开"
                                  IsCheckable="True"
                                  IsChecked="{Binding Args.SingleWindow, Mode=OneWayToSource}" />
                        <MenuItem Header="无痕模式" IsCheckable="True" IsChecked="{Binding Args.IsPrivate, Mode=OneWayToSource}" />
                    </StackPanel>
                </ScrollViewer>
            </Border>
        </Popup>
        <Grid x:Name="BrowserGrid"
              Grid.Row="1"
              Margin="0"
              PreviewMouseWheel="BrowserZoom" />
        <Border x:Name="SearchPanel"
                Grid.Row="1"
                HorizontalAlignment="Right" VerticalAlignment="Top"
                Background="White"
                CornerRadius="0,0,0,20" Visibility="Collapsed">
            <Border.Effect>
                <DropShadowEffect Opacity="0.2" Direction="225" />
            </Border.Effect>
            <StackPanel>
                <TextBox x:Name="SearchBox"
                         MaxWidth="300"
                         Margin="5,5,5,0"
                         Style="{StaticResource TextboxStyle}"
                         KeyUp="SearchBoxInput" />
                <StackPanel Margin="4,0,4,0" HorizontalAlignment="Center" Orientation="Horizontal">
                    <Button Padding="5,0"
                            Style="{StaticResource NavButton}"
                            Click="SearchPervious" Content="&#xE76B;" />
                    <Button Padding="5,0"
                            Style="{StaticResource NavButton}"
                            Click="SearchNext" Content="&#xE76C;" />
                    <Button Padding="5,0"
                            Style="{StaticResource NavButton}"
                            Click="SearchPanelClose" Content="&#xE711;" />
                </StackPanel>
            </StackPanel>
        </Border>
        <Border Grid.Row="1"
                HorizontalAlignment="Left" VerticalAlignment="Bottom"
                Background="#F1F3F4"
                CornerRadius="0,10,0,0">
            <Border.Effect>
                <DropShadowEffect Opacity="0.2" Direction="45" />
            </Border.Effect>
            <Grid>
                <ProgressBar x:Name="LoadProgress"
                             Background="{x:Null}"
                             Foreground="#B2005CBC" BorderThickness="0"
                             IsIndeterminate="True" />
                <StackPanel Orientation="Horizontal">
                    <Label x:Name="zoomLabel" Content="100%" Visibility="Collapsed" />
                    <Label x:Name="loadLabel" Content="加载中" />
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</Window>