<?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.OpenLyricsWindowCommand}"
        IconSource="ms-appx:///Assets/Logo.ico"
        LeftClickCommand="{x:Bind ViewModel.OpenLyricsWindowCommand}"
        NoLeftClickDelay="True"
        ToolTipText="{x:Bind ViewModel.ToolTipText, Mode=OneWay}">
        <tb:TaskbarIcon.ContextFlyout>
            <MenuFlyout
                AreOpenCloseAnimationsEnabled="True"
                LightDismissOverlayMode="On"
                ShowMode="TransientWithDismissOnPointerMoveAway">
                <MenuFlyoutItem x:Uid="SystemTrayMusicGallery" Command="{x:Bind ViewModel.OpenMusicGalleryCommand}" />
                <MenuFlyoutItem x:Uid="SystemTraySettings" Command="{x:Bind ViewModel.OpenSettingsCommand}" />
                <MenuFlyoutItem x:Uid="SystemTrayExit" Command="{x:Bind ViewModel.ExitAppCommand}" />
                <MenuFlyoutItem
                    x:Uid="SystemTrayUnlock"
                    Command="{x:Bind ViewModel.UnlockWindowCommand}"
                    Visibility="{x:Bind ViewModel.IsLyricsWindowLocked, Mode=OneWay, Converter={StaticResource BoolToVisibilityConverter}}" />
            </MenuFlyout>
        </tb:TaskbarIcon.ContextFlyout>
    </tb:TaskbarIcon>
</UserControl>
