Program.cs 699 B

12345678910111213141516171819202122232425
  1. using Microsoft.Extensions.DependencyInjection;
  2. using Terminal.Gui;
  3. namespace CommunityToolkitExample;
  4. public static class Program
  5. {
  6. public static IServiceProvider Services { get; private set; }
  7. private static void Main (string [] args)
  8. {
  9. Services = ConfigureServices ();
  10. Application.Init ();
  11. Application.Run (Services.GetRequiredService<LoginView> ());
  12. Application.Shutdown ();
  13. }
  14. private static IServiceProvider ConfigureServices ()
  15. {
  16. var services = new ServiceCollection ();
  17. services.AddTransient<LoginView> ();
  18. services.AddTransient<LoginViewModel> ();
  19. return services.BuildServiceProvider ();
  20. }
  21. }