<?xml version="1.0" encoding="utf-8" ?>
<UserControl
    x:Class="BetterLyrics.WinUI3.Controls.SystemTray"
    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:local="using:BetterLyrics.WinUI3.Controls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:tb="using:H.NotifyIcon"
    xmlns:ui="using:CommunityToolkit.WinUI"
    mc:Ignorable="d">

    <tb:TaskbarIcon
        x:Name="TrayIcon"
        x:FieldModifier="public"
        ContextMenuMode="SecondWindow"
        DoubleClickCommand="{x:Bind ViewModel.OpenLyricsCommand}"
        IconSource="ms-appx:///Assets/Logo.ico"
        LeftClickCommand="{x:Bind ViewModel.OpenLyricsCommand}"
        NoLeftClickDelay="True"
        ToolTipText="{x:Bind ViewModel.ToolTipText, Mode=OneWay}">
        <tb:TaskbarIcon.ContextFlyout>
            <MenuFlyout
                AreOpenCloseAnimationsEnabled="True"
                LightDismissOverlayMode="On"
                ShowMode="TransientWithDismissOnPointerMoveAway">
                <MenuFlyout.MenuFlyoutPresenterStyle>
                    <Style BasedOn="{StaticResource DefaultMenuFlyoutPresenterStyle}" TargetType="MenuFlyoutPresenter">
                        <Setter Property="MinWidth" Value="600" />
                    </Style>
                </MenuFlyout.MenuFlyoutPresenterStyle>
                <MenuFlyoutItem
                    x:Uid="SystemTrayLyrics"
                    Command="{x:Bind ViewModel.OpenLyricsCommand}"
                    Icon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
                                       Glyph=&#xE90B;}" />
                <MenuFlyoutItem
                    x:Uid="SystemTrayMusicGallery"
                    Command="{x:Bind ViewModel.OpenMusicGalleryCommand}"
                    Icon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
                                       Glyph=&#xEA69;}" />
                <MenuFlyoutItem
                    x:Uid="SystemTraySettings"
                    Command="{x:Bind ViewModel.OpenSettingsCommand}"
                    Icon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
                                       Glyph=&#xE713;}" />
                <MenuFlyoutSeparator />
                <MenuFlyoutItem
                    x:Uid="SystemTrayResetWindowPosition"
                    Command="{x:Bind ViewModel.ResetWindowPositionCommand}"
                    Icon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
                                       Glyph=&#xE923;}" />
                <MenuFlyoutSeparator />
                <MenuFlyoutItem
                    x:Uid="SystemTrayRestart"
                    Command="{x:Bind ViewModel.RestartAppCommand}"
                    Icon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
                                       Glyph=&#xE777;}" />
                <MenuFlyoutItem
                    x:Uid="SystemTrayExit"
                    Command="{x:Bind ViewModel.ExitAppCommand}"
                    Icon="{ui:FontIcon FontFamily={StaticResource IconFontFamily},
                                       Glyph=&#xE7E8;}" />
            </MenuFlyout>
        </tb:TaskbarIcon.ContextFlyout>
    </tb:TaskbarIcon>
</UserControl>
