2020-09-08 16:43:44 +08:00
|
|
|
|
using System.Globalization;
|
|
|
|
|
using System.Text.Encodings.Web;
|
2020-05-29 00:33:49 +08:00
|
|
|
|
using AntDesign;
|
|
|
|
|
using AntDesign.JsInterop;
|
2019-12-11 17:17:58 +08:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection.Extensions;
|
2020-03-11 17:15:15 +08:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2019-12-11 17:17:58 +08:00
|
|
|
|
|
2020-03-30 14:33:39 +08:00
|
|
|
|
namespace Microsoft.Extensions.DependencyInjection
|
2019-12-11 17:17:58 +08:00
|
|
|
|
{
|
|
|
|
|
public static class ServiceCollectionExtensions
|
|
|
|
|
{
|
2020-05-29 00:33:49 +08:00
|
|
|
|
public static IServiceCollection AddAntDesign(this IServiceCollection services)
|
2019-12-11 17:17:58 +08:00
|
|
|
|
{
|
2019-12-16 18:48:03 +08:00
|
|
|
|
services.TryAddScoped<DomEventService>();
|
2020-03-30 14:33:39 +08:00
|
|
|
|
services.TryAddScoped(sp => new HtmlRenderService(new HtmlRenderer(sp, sp.GetRequiredService<ILoggerFactory>(),
|
|
|
|
|
s => HtmlEncoder.Default.Encode(s)))
|
|
|
|
|
);
|
2020-03-11 17:15:15 +08:00
|
|
|
|
|
2020-10-10 15:31:32 +08:00
|
|
|
|
services.TryAddSingleton<IComponentIdGenerator, GuidComponentIdGenerator>();
|
2020-05-14 16:26:21 +08:00
|
|
|
|
services.TryAddScoped<IconService>();
|
2020-05-16 23:27:40 +08:00
|
|
|
|
services.TryAddScoped<InteropService>();
|
2020-05-19 20:08:49 +08:00
|
|
|
|
services.TryAddScoped<NotificationService>();
|
|
|
|
|
services.TryAddScoped<MessageService>();
|
2020-06-02 14:25:44 +08:00
|
|
|
|
services.TryAddScoped<ModalService>();
|
2020-06-23 15:19:44 +08:00
|
|
|
|
services.TryAddScoped<DrawerService>();
|
2020-08-22 09:24:55 +08:00
|
|
|
|
services.TryAddScoped<ConfirmService>();
|
2021-01-25 02:05:18 +08:00
|
|
|
|
services.TryAddScoped<ImageService>();
|
2021-03-12 17:02:11 +08:00
|
|
|
|
services.TryAddScoped<ConfigService>();
|
2020-05-10 22:43:58 +08:00
|
|
|
|
|
2020-09-08 16:43:44 +08:00
|
|
|
|
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.CurrentCulture;
|
|
|
|
|
|
2019-12-11 17:17:58 +08:00
|
|
|
|
return services;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-05-10 15:42:02 +08:00
|
|
|
|
}
|