增加托盘图标
This commit is contained in:
@@ -22,7 +22,9 @@
|
||||
<Content Include="Resources\Images\skel.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Resources\Images\spineviewer.ico" />
|
||||
<Content Include="Resources\Images\spineviewer.ico">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -5,6 +5,7 @@ using SFMLRenderer;
|
||||
using SpineViewer.Models;
|
||||
using SpineViewer.Services;
|
||||
using SpineViewer.Utils;
|
||||
using System.Windows;
|
||||
using System.Windows.Shell;
|
||||
|
||||
namespace SpineViewer.ViewModels.MainWindow
|
||||
@@ -72,6 +73,8 @@ namespace SpineViewer.ViewModels.MainWindow
|
||||
public SFMLRendererViewModel SFMLRendererViewModel => _sfmlRendererViewModel;
|
||||
private readonly SFMLRendererViewModel _sfmlRendererViewModel;
|
||||
|
||||
public RelayCommand Cmd_Exit => new(App.Current.Shutdown);
|
||||
|
||||
/// <summary>
|
||||
/// 打开工作区
|
||||
/// </summary>
|
||||
|
||||
@@ -480,7 +480,7 @@
|
||||
<ColumnDefinition Width="Auto" SharedSizeGroup="ColAniTime"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<Label Grid.Column="0" Content="{Binding TrackIndex}" HorizontalContentAlignment="Left" VerticalAlignment="Top" Background="#bfffffff"/>
|
||||
<Label Grid.Column="1" Content="{Binding AnimationDuration}" VerticalAlignment="Top" ContentStringFormat="{}{0:F3} s"/>
|
||||
|
||||
@@ -922,6 +922,21 @@
|
||||
Opened="BottomPopup_Opened"
|
||||
MouseLeave="PopupContainer_MouseLeave"/>
|
||||
</Grid>
|
||||
|
||||
<!-- 非可视元素通知栏图标 -->
|
||||
<hc:NotifyIcon x:Name="_notifyIcon"
|
||||
Icon="/Resources/Images/spineviewer.ico"
|
||||
Click="_notifyIcon_Click"
|
||||
MouseDoubleClick="_notifyIcon_MouseDoubleClick">
|
||||
<hc:NotifyIcon.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="There may be a funtion :)" IsChecked="True"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="{DynamicResource Str_Exit}" Command="{Binding Cmd_Exit}"/>
|
||||
</ContextMenu>
|
||||
</hc:NotifyIcon.ContextMenu>
|
||||
</hc:NotifyIcon>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
|
||||
@@ -44,8 +44,9 @@ public partial class MainWindow : Window
|
||||
{
|
||||
InitializeComponent();
|
||||
InitializeLogConfiguration();
|
||||
_vm = new (_renderPanel);
|
||||
DataContext = _vm;
|
||||
DataContext = _vm = new(_renderPanel);
|
||||
_notifyIcon.Text = _vm.Title; // XXX: hc 的 NotifyIcon 的 Text 似乎没法双向绑定
|
||||
|
||||
_vm.SpineObjectListViewModel.RequestSelectionChanging += SpinesListView_RequestSelectionChanging;
|
||||
_vm.SFMLRendererViewModel.RequestSelectionChanging += SpinesListView_RequestSelectionChanging;
|
||||
Loaded += MainWindow_Loaded;
|
||||
@@ -313,6 +314,31 @@ public partial class MainWindow : Window
|
||||
|
||||
#endregion
|
||||
|
||||
#region _spineFilesListBox 事件
|
||||
|
||||
private void SpineFilesListBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var list = (ListBox)sender;
|
||||
if (VisualUpwardSearch<ListBoxItem>(e.OriginalSource as DependencyObject) is null)
|
||||
list.SelectedItems.Clear();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region _nofityIcon 事件处理
|
||||
|
||||
private void _notifyIcon_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void _notifyIcon_MouseDoubleClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 切换全屏布局事件处理
|
||||
|
||||
private void SwitchToFullScreenLayout()
|
||||
@@ -571,10 +597,4 @@ public partial class MainWindow : Window
|
||||
|
||||
#endregion
|
||||
|
||||
private void SpineFilesListBox_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var list = (ListBox)sender;
|
||||
if (VisualUpwardSearch<ListBoxItem>(e.OriginalSource as DependencyObject) is null)
|
||||
list.SelectedItems.Clear();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user