Files
SteamTools/System.Application.SteamTools.Client.Desktop.Mac/ServiceCollectionExtensions.cs
T
2021-03-01 02:03:05 +08:00

25 lines
771 B
C#

using System;
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
{
public static IServiceCollection AddDesktopPlatformService(this IServiceCollection services)
{
if (DI.Platform == Platform.Apple)
{
services.AddSingleton<AppDelegate>();
services.AddSingleton<IDesktopPlatformService, MacDesktopPlatformServiceImpl>();
}
else
{
throw new PlatformNotSupportedException();
}
return services;
}
}
}