PIbd-23-Nasyrov-A.G.-Flower.../ProjectFlowerShop/Program.cs

61 lines
2.4 KiB
C#
Raw Normal View History

2024-02-12 17:52:44 +04:00
using FlowerShopBusinessLogic.BusinessLogic;
using FlowerShopContracts.BusinessLogicsContracts;
using FlowerShopContracts.StoragesContracts;
2024-02-27 17:21:18 +04:00
using FlowerShopFileImplement.Implements;
using ProjectFlowerShop;
2024-02-12 17:52:44 +04:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using System;
using System.Drawing;
2024-02-15 20:22:45 +04:00
using FlowerShopBusinessLogic;
2024-02-12 17:52:44 +04:00
2024-02-08 13:26:42 +04:00
namespace ProjectFlowerShop
{
internal static class Program
{
2024-02-12 17:52:44 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2024-02-08 13:26:42 +04:00
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
ApplicationConfiguration.Initialize();
2024-02-12 17:52:44 +04:00
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<MainForm>());
2024-02-08 13:26:42 +04:00
}
2024-02-12 17:52:44 +04:00
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<IFlowerStorage, FlowerStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IFlowerLogic, FlowerLogic>();
2024-02-15 20:22:45 +04:00
services.AddTransient<IShopStorage, ShopStorage>();
services.AddTransient<IShopLogic, ShopLogic>();
2024-02-12 17:52:44 +04:00
services.AddTransient<MainForm>();
services.AddTransient<ComponentForm>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
2024-02-28 14:41:07 +04:00
services.AddTransient<FormFlower>();
2024-02-27 17:21:18 +04:00
services.AddTransient<FormFlowerComponent>();
2024-02-12 17:52:44 +04:00
services.AddTransient<FormFlowers>();
2024-02-15 20:22:45 +04:00
services.AddTransient<ShopForm>();
services.AddTransient<ShopsForm>();
services.AddTransient<SupplyForm>();
2024-03-14 21:28:58 +04:00
services.AddTransient<SellForm>();
2024-02-12 17:52:44 +04:00
}
2024-02-08 13:26:42 +04:00
}
2024-02-12 17:52:44 +04:00
}