<UserControl
    x:Class="PDF_Office.Views.Dialog.FullScreenWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:dialog="clr-namespace:PDF_Office.ViewModels.Dialog"
    xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
    xmlns:local="clr-namespace:PDF_Office.Views.Dialog"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:prism="http://prismlibrary.com/"
    MinWidth="800"
    MinHeight="450"
    d:DataContext="{d:DesignInstance Type=dialog:FullScreenWindowViewModel}"
    prism:ViewModelLocator.AutoWireViewModel="True"
    mc:Ignorable="d">
    <prism:Dialog.WindowStyle>
        <Style TargetType="{x:Type Window}">
            <Setter Property="Title" Value="{Binding Title}" />
            <Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterScreen" />
            <Setter Property="ShowInTaskbar" Value="False" />
            <Setter Property="WindowState" Value="Maximized" />
            <Setter Property="WindowStyle" Value="None" />
        </Style>
    </prism:Dialog.WindowStyle>

    <UserControl.InputBindings>
        <KeyBinding Key="Esc" Command="{Binding ExitCommand}" />
    </UserControl.InputBindings>

    <Grid Name="GridRoot">
        <ContentControl prism:RegionManager.RegionName="{Binding RegionName}" />
        <Grid
            Name="GridTip"
            Height="32"
            VerticalAlignment="Top"
            Cursor="Hand">
            <TextBlock
                x:Name="PressEscTip"
                Padding="0,8,0,0"
                Background="#99000000"
                Foreground="#FFFFFFFF"
                Text="Press Esc to exit Full Screen"
                TextAlignment="Center" />
            <Button
                Name="BtnHideTip"
                Width="16"
                Height="16"
                Margin="0,0,12,0"
                HorizontalAlignment="Right">
                <Polygon Fill="#FFDBDDE5" Points="11.2919922 12 12 11.2919922 6.70800781 6 12 0.708007813 11.2919922 0 6 5.29199219 0.708007812 9.76996262e-15 -2.27456942e-13 0.708007813 5.29199219 6 0 11.2919922 0.708007812 12 6 6.70800781" />
                <Button.Triggers>
                    <!--  按钮点击后顶部栏消失  -->
                    <EventTrigger RoutedEvent="Button.Click">
                        <EventTrigger.Actions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <ObjectAnimationUsingKeyFrames
                                        BeginTime="00:00:00"
                                        Storyboard.TargetName="GridTip"
                                        Storyboard.TargetProperty="(UIElement.Visibility)">
                                        <DiscreteObjectKeyFrame KeyTime="00:00:0.1" Value="{x:Static Visibility.Collapsed}" />
                                    </ObjectAnimationUsingKeyFrames>
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger.Actions>
                    </EventTrigger>
                </Button.Triggers>
            </Button>
            <!--  通过动画设置顶部栏15秒后消失  -->
            <Grid.Triggers>
                <EventTrigger RoutedEvent="Loaded">
                    <EventTrigger.Actions>
                        <BeginStoryboard>
                            <Storyboard>
                                <ObjectAnimationUsingKeyFrames
                                    BeginTime="00:00:00"
                                    Storyboard.TargetName="GridTip"
                                    Storyboard.TargetProperty="(UIElement.Visibility)">
                                    <DiscreteObjectKeyFrame KeyTime="00:00:15" Value="{x:Static Visibility.Collapsed}" />
                                </ObjectAnimationUsingKeyFrames>
                            </Storyboard>
                        </BeginStoryboard>
                    </EventTrigger.Actions>
                </EventTrigger>
            </Grid.Triggers>
        </Grid>
        <cus:ToastControl
            Width="auto"
            Height="auto"
            Margin="0,0,0,300"
            VerticalAlignment="Bottom"
            Background="#89000000"
            BeginTime="0:0:0:3"
            CornerRadius="4"
            FontSize="14"
            Foreground="White"
            StringContent="Press Esc To Exit Full Mode"
            Visibility="{Binding ShowTip}"
            Duration="0:0:0:3" />
        <i:Interaction.Triggers>
            <i:EventTrigger EventName="Loaded">
                <i:InvokeCommandAction Command="{Binding LoadCommand}" CommandParameter="{Binding ElementName=GridRoot}" />
            </i:EventTrigger>
        </i:Interaction.Triggers>
    </Grid>
</UserControl>
