82 lines
6.5 KiB
XML
82 lines
6.5 KiB
XML
<UserControl x:Class="HandyControlDemo.UserControl.NotifyIconDemoCtl"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
|
xmlns:data="clr-namespace:HandyControlDemo.Data"
|
|
DataContext="{Binding NotifyIconDemo,Source={StaticResource Locator}}"
|
|
Background="{DynamicResource RegionBrush}">
|
|
<hc:TransitioningContentControl>
|
|
<hc:SimplePanel Margin="32" VerticalAlignment="Center">
|
|
<StackPanel>
|
|
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
|
<GroupBox Header="ContextMenu" Padding="10">
|
|
<StackPanel>
|
|
<GroupBox hc:TitleElement.TitleAlignment="Left" Style="{StaticResource GroupBoxOriginal}" Header="{x:Static langs:Lang.Visibility}">
|
|
<ToggleButton IsChecked="{Binding ContextMenuIsShow}" Style="{StaticResource ToggleButtonSwitch}"/>
|
|
</GroupBox>
|
|
<TextBlock Foreground="{DynamicResource InfoBrush}" Visibility="{Binding ContextMenuIsShow,Converter={StaticResource Boolean2VisibilityConverter}}" Text="{x:Static langs:Lang.Try2CloseApp}" Margin="0,6,0,0"/>
|
|
<GroupBox Margin="0,10,0,0" hc:TitleElement.TitleAlignment="Left" Style="{StaticResource GroupBoxOriginal}" Header="{x:Static langs:Lang.Blink}">
|
|
<ToggleButton IsChecked="{Binding ContextMenuIsBlink}" IsEnabled="{Binding ContextMenuIsShow}" Style="{StaticResource ToggleButtonSwitch}"/>
|
|
</GroupBox>
|
|
</StackPanel>
|
|
</GroupBox>
|
|
<GroupBox Header="ContextContent" Margin="16,0,0,0" Padding="10">
|
|
<StackPanel>
|
|
<GroupBox hc:TitleElement.TitleAlignment="Left" Style="{StaticResource GroupBoxOriginal}" Header="{x:Static langs:Lang.Visibility}">
|
|
<ToggleButton IsChecked="{Binding ContextContentIsShow}" Style="{StaticResource ToggleButtonSwitch}"/>
|
|
</GroupBox>
|
|
<TextBlock Foreground="{DynamicResource InfoBrush}" Visibility="{Binding ContextContentIsShow,Converter={StaticResource Boolean2VisibilityConverter}}" Text="{x:Static langs:Lang.Try2CloseApp}" Margin="0,6,0,0"/>
|
|
<GroupBox Margin="0,10,0,0" hc:TitleElement.TitleAlignment="Left" Style="{StaticResource GroupBoxOriginal}" Header="{x:Static langs:Lang.Blink}">
|
|
<ToggleButton IsChecked="{Binding ContextContentIsBlink}" IsEnabled="{Binding ContextContentIsShow}" Style="{StaticResource ToggleButtonSwitch}"/>
|
|
</GroupBox>
|
|
</StackPanel>
|
|
</GroupBox>
|
|
</StackPanel>
|
|
<DockPanel Margin="0,16,0,0" LastChildFill="True">
|
|
<Button Command="{Binding SendNotificationCmd}" Content="{x:Static langs:Lang.SendNotification}" DockPanel.Dock="Right" HorizontalAlignment="Stretch" Margin="10,0,0,0"/>
|
|
<TextBox Text="{Binding Content}"/>
|
|
</DockPanel>
|
|
</StackPanel>
|
|
<hc:NotifyIcon Token="{x:Static data:MessageToken.NotifyIconDemo}" Text="HandyControl" IsBlink="{Binding ContextMenuIsBlink}" Visibility="{Binding ContextMenuIsShow,Converter={StaticResource Boolean2VisibilityConverter}}">
|
|
<hc:NotifyIcon.ContextMenu>
|
|
<ContextMenu>
|
|
<MenuItem Command="{Binding SendNotificationCmd}" Header="{x:Static langs:Lang.SendNotification}"/>
|
|
<MenuItem Command="hc:ControlCommands.PushMainWindow2Top" Header="{x:Static langs:Lang.OpenPanel}"/>
|
|
<MenuItem Command="hc:ControlCommands.ShutdownApp" Header="{x:Static langs:Lang.Exit}"/>
|
|
</ContextMenu>
|
|
</hc:NotifyIcon.ContextMenu>
|
|
<hc:Interaction.Triggers>
|
|
<hc:EventTrigger EventName="Click">
|
|
<hc:EventToCommand Command="hc:ControlCommands.PushMainWindow2Top"/>
|
|
</hc:EventTrigger>
|
|
<hc:EventTrigger EventName="MouseDoubleClick">
|
|
<hc:EventToCommand Command="{Binding MouseCmd}" CommandParameter="MouseDoubleClick"/>
|
|
</hc:EventTrigger>
|
|
</hc:Interaction.Triggers>
|
|
</hc:NotifyIcon>
|
|
<hc:NotifyIcon Token="{x:Static data:MessageToken.NotifyIconContextDemo}" x:Name="NotifyIconContextContent" Text="HandyControl" IsBlink="{Binding ContextContentIsBlink}" Visibility="{Binding ContextContentIsShow,Converter={StaticResource Boolean2VisibilityConverter}}" Icon="/HandyControlDemo;component/Resources/Img/icon-white.ico">
|
|
<hc:NotifyIcon.ContextContent>
|
|
<Border CornerRadius="4" Margin="10" Background="{DynamicResource RegionBrush}" Effect="{StaticResource EffectShadow2}">
|
|
<StackPanel VerticalAlignment="Center" Margin="16">
|
|
<Path Width="100" Height="100" Fill="#f06632" Data="{StaticResource LogoGeometry}"/>
|
|
<StackPanel Margin="0,16,0,0" HorizontalAlignment="Center" Orientation="Horizontal">
|
|
<Button Click="ButtonPush_OnClick" Command="hc:ControlCommands.PushMainWindow2Top" MinWidth="100" Content="{x:Static langs:Lang.OpenPanel}"/>
|
|
<Button Command="hc:ControlCommands.ShutdownApp" Margin="16,0,0,0" MinWidth="100" Style="{StaticResource ButtonPrimary}" Content="{x:Static langs:Lang.Exit}"/>
|
|
</StackPanel>
|
|
</StackPanel>
|
|
</Border>
|
|
</hc:NotifyIcon.ContextContent>
|
|
<hc:Interaction.Triggers>
|
|
<hc:EventTrigger EventName="Click">
|
|
<hc:EventToCommand Command="hc:ControlCommands.PushMainWindow2Top"/>
|
|
</hc:EventTrigger>
|
|
<hc:EventTrigger EventName="MouseDoubleClick">
|
|
<hc:EventToCommand Command="{Binding MouseCmd}" CommandParameter="MouseDoubleClick"/>
|
|
</hc:EventTrigger>
|
|
</hc:Interaction.Triggers>
|
|
</hc:NotifyIcon>
|
|
</hc:SimplePanel>
|
|
</hc:TransitioningContentControl>
|
|
</UserControl>
|