You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WinForm
{
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpAutoMapperModule),
typeof(AbpHttpClientModule),
typeof(FmpApplicationContractsModule),
typeof(AbpHttpClientIdentityModelModule),
typeof(AbpIdentityHttpApiClientModule)
)]
public class WinFormModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddHttpClientProxies(
typeof(FmpApplicationContractsModule).Assembly,
remoteServiceConfigurationName: "Default"
);
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<FmpWpfModule>();
});
//var configuration = context.Services.GetConfiguration();
//ConfigureIdentityClientOption(context, configuration);
//context.Services.AddSingleton<FinancialMainWindow>();
context.Services.AddSingleton<LoginMainWindow>();
}
private static void ConfigureIdentityClientOption(ServiceConfigurationContext context, IConfiguration configuration)
{
var defaultClientConfiguration = new IdentityClientConfiguration(
configuration["IdentityClients:Default:Authority"],
configuration["IdentityClients:Default:Scope"],
configuration["IdentityClients:Default:ClientId"],
configuration["IdentityClients:Default:ClientSecret"],
configuration["IdentityClients:Default:GrantType"],
configuration["IdentityClients:Default:UserName"],
configuration["IdentityClients:Default:UserPassword"],
false,
1800
);
context.Services.AddOptions<AbpIdentityClientOptions>().Configure(option =>
{
option.IdentityClients.Default = defaultClientConfiguration;
});
}
}
}