Files
SteamTools/src/BD.WTTS.Client/Extensions/ServiceCollection/ServiceCollectionExtensions.TryAddNotificationService.cs
T
Aigio Liu 96a14d69bd 🚧 Misc
2024-08-06 17:09:13 +08:00

21 lines
737 B
C#

// ReSharper disable once CheckNamespace
namespace Microsoft.Extensions.DependencyInjection;
public static partial class ServiceCollectionExtensions
{
/// <summary>
/// 尝试添加由 NotifyIcon 实现的 <see cref="INotificationService"/>
/// </summary>
/// <param name="services"></param>
/// <returns></returns>
[BD.Mobius(
"""
services.AddSingleton<INativeNotificationService, NativeNotificationServiceImpl>();
""", Obsolete = true)]
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static IServiceCollection TryAddNotificationService(this IServiceCollection services)
{
services.TryAddSingleton<INotificationService, NotificationServiceImpl>();
return services;
}
}