<?xml version="1.0" encoding="utf-8" ?>
<winuiex:WindowEx
    x:Class="Wino.Mail.WinUI.ShellWindow"
    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:domain="using:Wino.Core.Domain"
    xmlns:local="using:Wino.Mail.WinUI"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:notifyicon="using:H.NotifyIcon"
    xmlns:winuiex="using:WinUIEx"
    Title="ShellWindow"
    mc:Ignorable="d">

    <!--  SystemBackdrop will be set by NewThemeService  -->

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

        <Grid Grid.RowSpan="2" Background="{ThemeResource WinoApplicationBackgroundColor}" />
        <TitleBar
            x:Name="ShellTitleBar"
            Title="{x:Bind StatePersistanceService.CoreWindowTitle, Mode=OneWay}"
            MinHeight="48"
            HorizontalContentAlignment="Stretch"
            VerticalContentAlignment="Stretch"
            BackRequested="BackButtonClicked"
            Background="Transparent"
            IsBackButtonVisible="{x:Bind StatePersistanceService.IsBackButtonVisible, Mode=OneWay}"
            IsPaneToggleButtonVisible="True"
            PaneToggleRequested="PaneButtonClicked" />

        <Frame
            x:Name="MainShellFrame"
            Grid.Row="1"
            Navigated="MainFrameNavigated" />

        <notifyicon:TaskbarIcon
            x:Name="SystemTrayIcon"
            ContextMenuMode="PopupMenu"
            DoubleClickCommand="{x:Bind ShowWinoCommand}"
            IconSource="/Assets/Wino_Icon.ico"
            NoLeftClickDelay="True">
            <notifyicon:TaskbarIcon.ContextFlyout>
                <MenuFlyout AreOpenCloseAnimationsEnabled="False">
                    <MenuFlyoutItem Command="{x:Bind ShowWinoCommand}" Text="{x:Bind domain:Translator.SystemTrayMenu_ShowWino}" />
                    <MenuFlyoutSeparator />
                    <MenuFlyoutItem Command="{x:Bind ExitWinoCommand}" Text="{x:Bind domain:Translator.SystemTrayMenu_ExitWino}" />
                </MenuFlyout>
            </notifyicon:TaskbarIcon.ContextFlyout>
        </notifyicon:TaskbarIcon>
    </Grid>
</winuiex:WindowEx>
