PIbd-21_Ihonkina_E.S._Preca.../PrecastConcretePlant/Program.cs

61 lines
2.5 KiB
C#
Raw Normal View History

2023-02-19 11:27:59 +04:00
using PrecastConcretePlantBusinessLogic.BusinessLogic;
2023-03-22 20:33:00 +04:00
using PrecastConcretePlantBusinessLogic.OfficePackage.Implements;
using PrecastConcretePlantBusinessLogic.OfficePackage;
2023-02-19 11:27:59 +04:00
using PrecastConcretePlantContracts.BusinessLogicsContracts;
using PrecastConcretePlantContracts.StoragesContracts;
2023-03-18 19:33:11 +04:00
using PrecastConcretePlantDatabaseImplement.Implements;
2023-03-22 20:33:00 +04:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using System;
using PrecastConcretePlantBusinessLogic.BusinessLogics;
using PrecastConcretePlantView;
2023-02-19 11:27:59 +04:00
2023-02-19 11:15:20 +04:00
namespace PrecastConcretePlant
{
internal static class Program
{
2023-02-19 11:27:59 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2023-02-19 11:15:20 +04:00
[STAThread]
static void Main()
{
ApplicationConfiguration.Initialize();
2023-02-19 11:27:59 +04:00
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
private static void ConfigureServices(ServiceCollection services)
{
services.AddLogging(option =>
{
option.SetMinimumLevel(LogLevel.Information);
option.AddNLog("nlog.config");
});
services.AddTransient<IComponentStorage, ComponentStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
services.AddTransient<IReinforcedStorage, ReinforcedStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IReinforcedLogic, ReinforcedLogic>();
2023-03-22 20:33:00 +04:00
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
2023-02-19 11:27:59 +04:00
services.AddTransient<FormMain>();
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormReinforced>();
services.AddTransient<FormReinforcedComponent>();
services.AddTransient<FormReinforceds>();
2023-03-22 20:33:00 +04:00
services.AddTransient<FormReportReinforcedComponents>();
services.AddTransient<FormReportOrders>();
2023-02-19 11:15:20 +04:00
}
}
}