refactor: 替换任务栏图标库为 H.NotifyIcon (#425)

更新所有相关文件和引用,从 Hardcodet.Wpf.TaskbarNotification 迁移到 H.NotifyIcon
调整通知显示方式并添加 ForceCreate 调用确保图标正确显示

Signed-off-by: doudou0720 <98651603+doudou0720@users.noreply.github.com>
This commit is contained in:
doudou0720
2026-04-05 15:04:37 +08:00
committed by GitHub
parent 8f3b65c6d4
commit 24c6ca60a3
9 changed files with 32 additions and 15 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Ink_Canvas" xmlns:local="clr-namespace:Ink_Canvas"
xmlns:tb="http://www.hardcodet.net/taskbar" xmlns:tb="clr-namespace:H.NotifyIcon;assembly=H.NotifyIcon.Wpf"
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern" xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf" xmlns:ikw="http://schemas.inkore.net/lib/ui/wpf"
> >
+2 -1
View File
@@ -1,4 +1,4 @@
using Hardcodet.Wpf.TaskbarNotification; using H.NotifyIcon;
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using Ink_Canvas.Properties; using Ink_Canvas.Properties;
using iNKORE.UI.WPF.Modern.Controls; using iNKORE.UI.WPF.Modern.Controls;
@@ -1061,6 +1061,7 @@ namespace Ink_Canvas
} }
_taskbar = (TaskbarIcon)FindResource("TaskbarTrayIcon"); _taskbar = (TaskbarIcon)FindResource("TaskbarTrayIcon");
_taskbar.ForceCreate();
StartArgs = e.Args; StartArgs = e.Args;
@@ -1,4 +1,4 @@
using Hardcodet.Wpf.TaskbarNotification; using H.NotifyIcon;
using Microsoft.Toolkit.Uwp.Notifications; using Microsoft.Toolkit.Uwp.Notifications;
using System; using System;
using System.Windows; using System.Windows;
@@ -40,10 +40,9 @@ namespace Ink_Canvas.Helpers
taskbar.Visibility = Visibility.Visible; taskbar.Visibility = Visibility.Visible;
taskbar.ShowBalloonTip( taskbar.ShowNotification(
"InkCanvasForClass CE", "InkCanvasForClass CE",
$"发现新版本!:{version}", $"发现新版本!:{version}");
BalloonIcon.Info);
} }
catch catch
{ {
+1 -1
View File
@@ -135,7 +135,7 @@
<PackageReference Include="Costura.Fody" Version="6.0.0"> <PackageReference Include="Costura.Fody" Version="6.0.0">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Hardcodet.NotifyIcon.Wpf" Version="2.0.1" /> <PackageReference Include="H.NotifyIcon.Wpf" Version="2.0.131" />
<PackageReference Include="iNKORE.UI.WPF.Modern" Version="0.10.2.1" /> <PackageReference Include="iNKORE.UI.WPF.Modern" Version="0.10.2.1" />
<PackageReference Include="iNKORE.UI.WPF" Version="1.2.8" /> <PackageReference Include="iNKORE.UI.WPF" Version="1.2.8" />
<PackageReference Include="MdXaml" Version="1.27.0" /> <PackageReference Include="MdXaml" Version="1.27.0" />
+1 -1
View File
@@ -1,4 +1,4 @@
using Hardcodet.Wpf.TaskbarNotification; using H.NotifyIcon;
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using Newtonsoft.Json; using Newtonsoft.Json;
using OSVersionExtension; using OSVersionExtension;
@@ -1,4 +1,4 @@
using Hardcodet.Wpf.TaskbarNotification; using H.NotifyIcon;
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
+1 -1
View File
@@ -1,4 +1,4 @@
using Hardcodet.Wpf.TaskbarNotification; using H.NotifyIcon;
using Ink_Canvas.Helpers; using Ink_Canvas.Helpers;
using iNKORE.UI.WPF.Controls; using iNKORE.UI.WPF.Controls;
using System; using System;
@@ -1,4 +1,4 @@
using Hardcodet.Wpf.TaskbarNotification; using H.NotifyIcon;
using iNKORE.UI.WPF.Helpers; using iNKORE.UI.WPF.Helpers;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
+21 -4
View File
@@ -48,11 +48,15 @@
"Fody": "6.8.2" "Fody": "6.8.2"
} }
}, },
"Hardcodet.NotifyIcon.Wpf": { "H.NotifyIcon.Wpf": {
"type": "Direct", "type": "Direct",
"requested": "[2.0.1, )", "requested": "[2.0.131, )",
"resolved": "2.0.1", "resolved": "2.0.131",
"contentHash": "dtxmeZXzV2GzSm91aZ3hqzgoeVoARSkDPVCYfhVUNyyKBWYxMgNC0EcLiSYxD4Uc4alq/2qb3SmV8DgAENLRLQ==" "contentHash": "f71kXNl6PjCqipJ7DQytg1QUBMQ+7j8rF1UyL8UPegymG1G57EYsskdIcf/VmF6JDuts6Dk6F8Hd4ziiz4/3Dw==",
"dependencies": {
"H.NotifyIcon": "2.0.131",
"System.ValueTuple": "4.5.0"
}
}, },
"iNKORE.UI.WPF": { "iNKORE.UI.WPF": {
"type": "Direct", "type": "Direct",
@@ -185,6 +189,19 @@
"resolved": "6.8.2", "resolved": "6.8.2",
"contentHash": "sjGHrtGS1+kcrv99WXCvujOFBTQp4zCH3ZC9wo2LAtVaJkuLpHghQx3y4k1Q8ZKuDAbEw+HE6ZjPUJQK3ejepQ==" "contentHash": "sjGHrtGS1+kcrv99WXCvujOFBTQp4zCH3ZC9wo2LAtVaJkuLpHghQx3y4k1Q8ZKuDAbEw+HE6ZjPUJQK3ejepQ=="
}, },
"H.GeneratedIcons.System.Drawing": {
"type": "Transitive",
"resolved": "2.0.131",
"contentHash": "QoNGQrhxzG+dQufa4xRjSqihMy5aVVVZqQUt0fLJbwhs7rcM4hpN1qVkZpZEkHsRgrHfFBC/Ursjh8STY/sg7A=="
},
"H.NotifyIcon": {
"type": "Transitive",
"resolved": "2.0.131",
"contentHash": "mdznQAfcJFehblFoDUvtmdm1Y9+u1eMN1ffORbdYv5EwreMxkCwvdj8qQn3qnUo9EIJ6h5Xdgqey9Nj4us8w7w==",
"dependencies": {
"H.GeneratedIcons.System.Drawing": "2.0.131"
}
},
"MdXaml.Plugins": { "MdXaml.Plugins": {
"type": "Transitive", "type": "Transitive",
"resolved": "1.27.0", "resolved": "1.27.0",