12345678910111213141516171819202122232425262728293031323334 |
- using System.Reflection;
- using HZY.Framework.DependencyInjection;
- using Microsoft.Extensions.DependencyInjection;
- namespace Scada
- {
- internal static class Program
- {
- /// <summary>
- /// The main entry point for the application.
- /// </summary>
- [STAThread]
- static void Main()
- {
- var services = new ServiceCollection();
- ConfigureServices(services);
- ApplicationConfiguration.Initialize();
- var serviceProvider = services.BuildServiceProvider();
- Globals.ServiceProvider = serviceProvider;
- var frmMain = serviceProvider.GetRequiredService<FormMain>();
-
- Application.Run(frmMain);
- }
- private static void ConfigureServices(ServiceCollection services)
- {
- services.AddDependencyInjection(options =>
- {
- options.Assemblies = new[] { typeof(Program).Assembly };
- });
- }
- }
- }
|