69 lines
2.8 KiB
C#
69 lines
2.8 KiB
C#
using System;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using NLog.Extensions.Logging;
|
|
using Microsoft.Extensions.Logging;
|
|
using Contracts.StorageContracts;
|
|
using DatabaseImplement.Implements;
|
|
using Contracts.BusinessLogicContracts;
|
|
using BusinessLogic.BusinessLogic;
|
|
using BusinessLogic.OfficePackage.Implements;
|
|
using BusinessLogic.OfficePackage;
|
|
using System.Text;
|
|
|
|
namespace WinFormsApp
|
|
{
|
|
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()
|
|
{
|
|
|
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
|
// 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<ISupplyStorage, SupplyStorage>();
|
|
//services.AddTransient<ISupplyDocStorage, SupplyDocStorage>();
|
|
services.AddTransient<IProductStorage, ProductStorage>();
|
|
services.AddTransient<ISupplierStorage, SupplierStorage>();
|
|
services.AddTransient<IMediaFileStorage, MediaFileStorage>();
|
|
|
|
services.AddTransient<ISupplyLogic, SupplyLogic>();
|
|
services.AddTransient<ISupplierLogic, SupplierLogic>();
|
|
services.AddTransient<IProductLogic, ProductLogic>();
|
|
services.AddTransient<IMediaFileLogic, MediaFileLogic>();
|
|
services.AddTransient<IReportLogic, ReportLogic>();
|
|
|
|
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
|
services.AddTransient<AbstractSaveToPdfCheque, SaveToPdfCheque>();
|
|
|
|
services.AddTransient<FormMain>();
|
|
services.AddTransient<FormProducts>();
|
|
services.AddTransient<FormSuppliers>();
|
|
services.AddTransient<FormSupplier>();
|
|
services.AddTransient<FormSupply>();
|
|
services.AddTransient<FormSupplyProduct>();
|
|
services.AddTransient<FormSupplierProduct>();
|
|
services.AddTransient<FormMediaFiles>();
|
|
services.AddTransient<FormPreviewPDF>();
|
|
services.AddTransient<FormStatistics>();
|
|
}
|
|
}
|
|
} |