Program.cs 736 B

1234567891011121314151617181920212223242526
  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.Top?.Dispose();
  13. Application.Shutdown ();
  14. }
  15. private static IServiceProvider ConfigureServices ()
  16. {
  17. var services = new ServiceCollection ();
  18. services.AddTransient<LoginView> ();
  19. services.AddTransient<LoginViewModel> ();
  20. return services.BuildServiceProvider ();
  21. }
  22. }