<Window x:Class="Translumo.MVVM.Views.BrowserView"
        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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:controls="clr-namespace:Translumo.Controls"
        xmlns:wpf="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
        xmlns:system="clr-namespace:System;assembly=System.Runtime"
        mc:Ignorable="d"
        Title="{DynamicResource Str.Title.BrowserWindow}" Height="780" Width="750" Activated="Window_Activated" Deactivated="Window_Deactivated" DataContext="{Binding RelativeSource={RelativeSource Self}}" SourceInitialized="Window_SourceInitialized" Closed="Window_Closed" >
    <Window.Resources>
        <system:Double x:Key="OverlayHeight">55</system:Double>
    </Window.Resources>
    <Grid Name="LayoutGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="55"></RowDefinition>
            <RowDefinition Height="*"></RowDefinition>
        </Grid.RowDefinitions>
        <controls:OverlayControl Grid.Row="0" x:Name="OverlayNotification" Height="0" VerticalAlignment="Top">
            <controls:OverlayControl.Triggers>
                <EventTrigger RoutedEvent="Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard TargetProperty="Height">
                                <!--Show caption-->
                                <DoubleAnimation BeginTime="0:0:1" From="0" To="{StaticResource OverlayHeight}" AutoReverse="False" Duration="0:0:0.250"></DoubleAnimation>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="TbCaption">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:0.190" Value="{x:Static Visibility.Visible}"/>
                                </ObjectAnimationUsingKeyFrames>

                                <!--Hide caption-->
                                <DoubleAnimation BeginTime="0:0:6" From="{StaticResource OverlayHeight}" To="0" AutoReverse="False" Duration="0:0:0.200"></DoubleAnimation>
                                <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="TbCaption">
                                    <DiscreteObjectKeyFrame KeyTime="0:0:6.10" Value="{x:Static Visibility.Collapsed}"/>
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </controls:OverlayControl.Triggers>

            <Grid>
                <Grid.Background>
                    <SolidColorBrush Opacity="0.5" Color="{Binding Color, Source={StaticResource PrimaryHueMidBrush}}"></SolidColorBrush>
                </Grid.Background>
                <TextBlock Text="{Binding NotificationCaption}" Name="TbCaption" Visibility="Collapsed" Style="{StaticResource NotificationTextBlock}" Margin="5,0,0,0"/>
            </Grid>
        </controls:OverlayControl>

        <wpf:WebView2 Name="Browser" Grid.Row="0" Grid.RowSpan="2"/>
    </Grid>
</Window>
