ISEbd_21_Kuklew_M.I._Softwa.../SoftwareInstallation/Program.cs

61 lines
2.5 KiB
C#
Raw Normal View History

2024-05-12 14:38:32 +04:00
using SoftwareInstallationBusinessLogic.BusinessLogics;
2024-04-07 17:05:30 +04:00
using SoftwareInstallationContracts.BusinessLogicsContracts;
using SoftwareInstallationContracts.StoragesContracts;
using SoftwareInstallationFileImplement.Implements;
2024-04-07 16:54:02 +04:00
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
2024-05-12 14:38:32 +04:00
namespace SoftwareInstallationView
2024-04-07 16:21:01 +04:00
{
internal static class Program
{
2024-04-07 16:54:02 +04:00
private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider;
2024-05-12 14:38:32 +04:00
2024-04-07 16:21:01 +04:00
/// <summary>
2024-04-07 17:05:30 +04:00
/// The main entry point for the application.
2024-04-07 16:21:01 +04:00
/// </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();
2024-04-07 16:54:02 +04:00
var services = new ServiceCollection();
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
}
2024-05-12 14:38:32 +04:00
2024-04-07 16:54:02 +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<IPackageStorage, PackageStorage>();
2024-05-12 14:38:32 +04:00
services.AddTransient<IShopStorage, ShopStorage>();
2024-04-07 16:54:02 +04:00
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IPackageLogic, PackageLogic>();
2024-05-12 14:38:32 +04:00
services.AddTransient<IShopLogic, ShopLogic>();
2024-04-07 17:05:30 +04:00
services.AddTransient<FormMain>();
2024-04-07 16:54:02 +04:00
services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>();
services.AddTransient<FormPackage>();
services.AddTransient<FormPackageComponent>();
services.AddTransient<FormPackages>();
2024-05-12 14:38:32 +04:00
services.AddTransient<FormShop>();
services.AddTransient<FormShops>();
services.AddTransient<FormMakeShipment>();
services.AddTransient<FormPackageSale>();
2024-04-07 16:21:01 +04:00
}
}
}