PIbd-23-Volkov-N.A.-Compute.../ComputersShop/ComputersShopView/Program.cs

67 lines
2.5 KiB
C#
Raw Normal View History

2024-02-05 20:36:39 +04:00
using ComputersShopBusinessLogic.BusinessLogics;
2024-03-18 18:43:53 +04:00
using ComputersShopBusinessLogic.OfficePackage.Implements;
using ComputersShopBusinessLogic.OfficePackage;
2024-02-05 20:36:39 +04:00
using ComputersShopContracts.BusinessLogicContracts;
using ComputersShopContracts.StoragesContracts;
2024-03-04 22:33:22 +04:00
using ComputersShopDataBaseImplement.Implements;
2024-02-05 20:36:39 +04:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
2024-02-18 13:58:39 +04:00
2024-02-05 20:36:39 +04:00
namespace ComputersShopView
{
internal static class Program
{
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
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<IComputerStorage, ComputerStorage>();
services.AddTransient<IOrderStorage, OrderStorage>();
2024-04-01 20:00:17 +04:00
services.AddTransient<IClientStorage, ClientStorage>();
2024-02-05 20:36:39 +04:00
2024-04-01 20:00:17 +04:00
services.AddTransient<IComponentLogic, ComponentLogic>();
2024-02-05 20:36:39 +04:00
services.AddTransient<IComputerLogic, ComputerLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
2024-03-18 18:43:53 +04:00
services.AddTransient<IReportLogic, ReportLogic>();
2024-04-01 20:00:17 +04:00
services.AddTransient<IClientLogic, ClientLogic>();
2024-02-05 20:36:39 +04:00
2024-03-18 18:43:53 +04:00
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<FormMain>();
2024-04-01 20:00:17 +04:00
services.AddTransient<FormClients>();
services.AddTransient<FormComponent>();
2024-02-05 20:36:39 +04:00
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormComputer>();
services.AddTransient<FormComputers>();
services.AddTransient<FormComputerComponent>();
2024-03-18 18:43:53 +04:00
services.AddTransient<FormReportComputerComponents>();
services.AddTransient<FormReportOrders>();
}
2024-02-05 20:36:39 +04:00
}
}