using Avalonia.Controls; using System.Application.Services; using System.Application.Services.Implementation; using System.Application.UI; // ReSharper disable once CheckNamespace namespace Microsoft.Extensions.DependencyInjection { public static class ServiceCollectionExtensions { /// /// 添加主线程助手类(MainThreadDesktop)服务 /// /// /// public static IServiceCollection AddMainThreadPlatformService(this IServiceCollection services) { services.AddSingleton(); return services; } /// /// 添加应用程序更新服务 /// /// /// public static IServiceCollection AddAppUpdateService(this IServiceCollection services) { services.AddSingleton(); return services; } /// /// 添加托盘图标 /// /// /// /// public static IServiceCollection AddNotifyIcon(this IServiceCollection services) where TNotifyIcon : class, INotifyIcon { services.AddSingleton.IUIFrameworkHelper, INotifyIcon.UIFrameworkHelper>(); services.AddSingleton(); services.AddSingleton(s => s.GetRequiredService()); services.AddSingleton>(s => s.GetRequiredService()); return services; } } }