Merge branch 'develop' into dependabot/nuget/Microsoft.AspNetCore.Authentication.OpenIdConnect-6.0.0

This commit is contained in:
Aigio L
2021-11-09 21:44:17 +08:00
committed by GitHub
5 changed files with 28 additions and 11 deletions
+2 -2
View File
@@ -104,7 +104,7 @@
<PackageVersion Include="Microsoft.Extensions.Logging.AzureAppServices" Version="6.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.0" />
<PackageVersion Include="NLog.Web.AspNetCore" Version="4.14.0" />
<PackageVersion Include="Z.EntityFramework.Plus.EFCore" Version="5.2.17" />
<PackageVersion Include="Z.EntityFramework.Plus.EFCore" Version="6.13.0" />
<PackageVersion Include="AutoMapper" Version="10.1.1" />
<PackageVersion Include="AutoMapper.Collection" Version="7.0.1" />
<PackageVersion Include="AutoMapper.Collection.EntityFrameworkCore" Version="7.0.1" />
@@ -119,7 +119,7 @@
<PackageVersion Include="AspNet.Security.OpenId.Steam" Version="6.0.0" />
<PackageVersion Include="AspNet.Security.OAuth.QQ" Version="6.0.0" />
<PackageVersion Include="AspNet.Security.OAuth.Apple" Version="6.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="5.0.11" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.MicrosoftAccount" Version="6.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Authentication.OpenIdConnect" Version="6.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.0" />
@@ -30,11 +30,11 @@ using Avalonia.Controls;
namespace System.Application.UI
{
/// <summary>
/// NotifyIcon / TrayIcon 右下角托盘菜单助手类
/// </summary>
static class NotifyIconHelper
/// <inheritdoc cref="INotificationService.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;
}
@@ -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
@@ -56,5 +56,19 @@ namespace System.Application.Services
/// </summary>
/// <returns></returns>
static Task<Guid?> GetLastNotificationRecordId() => IStorage.Instance.GetAsync<Guid?>(ON_LAST_STARTUP_NOTIFICATION_RECORD_ID);
/// <summary>
/// NotifyIcon / TrayIcon 右下角托盘菜单助手类
/// </summary>
public abstract class NotifyIconHelper
{
protected NotifyIconHelper() => throw new NotSupportedException();
/// <summary>
/// 托盘初始化是否完成
/// <para>注意:在 Windows 上托盘初始化之前调用气泡消息会导致托盘不显示</para>
/// </summary>
public static bool IsInitialized { get; protected set; }
}
}
}
@@ -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<NotificationType, Entrance, 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<NotificationType, Entrance, INotificationService>.CancelAll()
{
if (OperatingSystem2.IsWindows)
if (OperatingSystem2.IsWindows && NotifyIconHelper.IsInitialized)
{
notifyIcon.HideBalloonTip();
}
@@ -36,7 +37,7 @@ namespace System.Application.Services.Implementation
void INotificationService<NotificationType, Entrance, INotificationService>.Notify(string text, NotificationType notificationType, bool autoCancel, string? title, Entrance entrance)
{
if (OperatingSystem2.IsWindows)
if (OperatingSystem2.IsWindows && NotifyIconHelper.IsInitialized)
{
title ??= ThisAssembly.AssemblyTrademark;
// 调用托盘显示通知