34 lines
1 KiB
C#
34 lines
1 KiB
C#
|
|
using ImageCatalog;
|
|||
|
|
using ImageCatalog_2.Services;
|
|||
|
|
using Microsoft.Extensions.DependencyInjection;
|
|||
|
|
|
|||
|
|
namespace ImageCatalog_2
|
|||
|
|
{
|
|||
|
|
static class Program
|
|||
|
|
{
|
|||
|
|
public static IServiceProvider ServiceProvider { get; private set; }
|
|||
|
|
[STAThread]
|
|||
|
|
static void Main()
|
|||
|
|
{
|
|||
|
|
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
|||
|
|
Application.EnableVisualStyles();
|
|||
|
|
Application.SetCompatibleTextRenderingDefault(false);
|
|||
|
|
|
|||
|
|
var serviceCollection = new ServiceCollection();
|
|||
|
|
ConfigureServices(serviceCollection);
|
|||
|
|
|
|||
|
|
ServiceProvider = serviceCollection.BuildServiceProvider();
|
|||
|
|
|
|||
|
|
Application.Run(ServiceProvider.GetRequiredService<MainForm>());
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private static void ConfigureServices(ServiceCollection services)
|
|||
|
|
{
|
|||
|
|
// Register your services here
|
|||
|
|
services.AddTransient<ITestService, TestService>();
|
|||
|
|
|
|||
|
|
// Register your forms
|
|||
|
|
services.AddTransient<MainForm>();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|