From 863c6e62abc5d56368443951c61277b3ce9883fa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 08:54:51 +0000 Subject: [PATCH 1/4] Bump Z.EntityFramework.Plus.EFCore from 5.2.17 to 6.13.0 Bumps [Z.EntityFramework.Plus.EFCore](https://github.com/zzzprojects/EntityFramework-Plus) from 5.2.17 to 6.13.0. - [Release notes](https://github.com/zzzprojects/EntityFramework-Plus/releases) - [Commits](https://github.com/zzzprojects/EntityFramework-Plus/commits) --- updated-dependencies: - dependency-name: Z.EntityFramework.Plus.EFCore dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 5d76fe0fc..06b55910f 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -104,7 +104,7 @@ - + From a515b94830f5b4ddcba947642b4796f5fdda403d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Nov 2021 08:55:45 +0000 Subject: [PATCH 2/4] Bump Microsoft.AspNetCore.Authentication.MicrosoftAccount Bumps [Microsoft.AspNetCore.Authentication.MicrosoftAccount](https://github.com/dotnet/aspnetcore) from 5.0.11 to 6.0.0. - [Release notes](https://github.com/dotnet/aspnetcore/releases) - [Commits](https://github.com/dotnet/aspnetcore/compare/v5.0.11...v6.0.0) --- updated-dependencies: - dependency-name: Microsoft.AspNetCore.Authentication.MicrosoftAccount dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- Directory.Packages.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 5d76fe0fc..b321b1335 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -119,7 +119,7 @@ - + From 321ee7329ab3b26a8069fc75eba83b0f6283620d Mon Sep 17 00:00:00 2001 From: Aigio Liu Date: Tue, 9 Nov 2021 17:06:58 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8DWindows?= =?UTF-8?q?=E4=B8=8A=E6=89=98=E7=9B=98=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NotifyIconHelper.cs | 10 ++++++---- src/ST.Client/Services/INotificationService.cs | 14 ++++++++++++++ .../Implementation/NotificationServiceImpl.cs | 7 ++++--- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/ST.Client.Desktop.Avalonia.App/NotifyIconHelper.cs b/src/ST.Client.Desktop.Avalonia.App/NotifyIconHelper.cs index e14abd8c8..a6caf3bc5 100644 --- a/src/ST.Client.Desktop.Avalonia.App/NotifyIconHelper.cs +++ b/src/ST.Client.Desktop.Avalonia.App/NotifyIconHelper.cs @@ -30,11 +30,11 @@ using Avalonia.Controls; namespace System.Application.UI { - /// - /// NotifyIcon / TrayIcon 右下角托盘菜单助手类 - /// - static class NotifyIconHelper + /// + sealed class NotifyIconHelper : INotificationService.NotifyIconHelper { + private NotifyIconHelper() => throw new NotSupportedException(); + #if !TRAY_INDEPENDENT_PROGRAM static Stream GetIcon(IAssetLoader assets) { @@ -58,6 +58,7 @@ namespace System.Application.UI public static NotifyIcon? Init(App app, EventHandler notifyIconClick) { + if (IsInitialized) return null; NotifyIcon? notifyIcon = null; IDisposable? menuItemDisposable = null; var icon = GetIconByCurrentAvaloniaLocator(); @@ -125,6 +126,7 @@ namespace System.Application.UI } } if (menuItemDisposable != null) menuItemDisposable.AddTo(app); + IsInitialized = true; return notifyIcon; } diff --git a/src/ST.Client/Services/INotificationService.cs b/src/ST.Client/Services/INotificationService.cs index 518965c58..20884bad6 100644 --- a/src/ST.Client/Services/INotificationService.cs +++ b/src/ST.Client/Services/INotificationService.cs @@ -56,5 +56,19 @@ namespace System.Application.Services /// /// static Task GetLastNotificationRecordId() => IStorage.Instance.GetAsync(ON_LAST_STARTUP_NOTIFICATION_RECORD_ID); + + /// + /// NotifyIcon / TrayIcon 右下角托盘菜单助手类 + /// + public abstract class NotifyIconHelper + { + protected NotifyIconHelper() => throw new NotSupportedException(); + + /// + /// 托盘初始化是否完成 + /// 注意:在 Windows 上托盘初始化之前调用气泡消息会导致托盘不显示 + /// + public static bool IsInitialized { get; protected set; } + } } } \ No newline at end of file diff --git a/src/ST.Client/Services/Implementation/NotificationServiceImpl.cs b/src/ST.Client/Services/Implementation/NotificationServiceImpl.cs index 7d972930b..e95d5e3dc 100644 --- a/src/ST.Client/Services/Implementation/NotificationServiceImpl.cs +++ b/src/ST.Client/Services/Implementation/NotificationServiceImpl.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Text; using System.Properties; using System.Windows; +using static System.Application.Services.INotificationService; namespace System.Application.Services.Implementation { @@ -20,7 +21,7 @@ namespace System.Application.Services.Implementation void INotificationService.Cancel(NotificationType notificationType) { - if (OperatingSystem2.IsWindows) + if (OperatingSystem2.IsWindows && NotifyIconHelper.IsInitialized) { notifyIcon.HideBalloonTip(); } @@ -28,7 +29,7 @@ namespace System.Application.Services.Implementation void INotificationService.CancelAll() { - if (OperatingSystem2.IsWindows) + if (OperatingSystem2.IsWindows && NotifyIconHelper.IsInitialized) { notifyIcon.HideBalloonTip(); } @@ -36,7 +37,7 @@ namespace System.Application.Services.Implementation void INotificationService.Notify(string text, NotificationType notificationType, bool autoCancel, string? title, Entrance entrance) { - if (OperatingSystem2.IsWindows) + if (OperatingSystem2.IsWindows && NotifyIconHelper.IsInitialized) { title ??= ThisAssembly.AssemblyTrademark; // 调用托盘显示通知 From fdf60a980d901e986e90e3d5ff6e4cb39a281569 Mon Sep 17 00:00:00 2001 From: Aigio Liu Date: Tue, 9 Nov 2021 17:09:49 +0800 Subject: [PATCH 4/4] fix assembly: SupportedOSPlatform --- src/ST.Client.Desktop.Avalonia.App/Program.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ST.Client.Desktop.Avalonia.App/Program.cs b/src/ST.Client.Desktop.Avalonia.App/Program.cs index 068644e50..0245de7aa 100644 --- a/src/ST.Client.Desktop.Avalonia.App/Program.cs +++ b/src/ST.Client.Desktop.Avalonia.App/Program.cs @@ -8,9 +8,9 @@ using System.Runtime.Versioning; #elif LINUX [assembly: SupportedOSPlatform("Linux")] #elif WINDOWS_DESKTOP_BRIDGE -[assembly: SupportedOSPlatform("Windows")] -#elif WINDOWS [assembly: SupportedOSPlatform("Windows10.0.17763.0")] +#elif WINDOWS +[assembly: SupportedOSPlatform("Windows")] #endif namespace System.Application.UI