Program.cs 796 B

123456789101112131415161718192021222324252627
  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. ConfigurationManager.Enable (ConfigLocations.All);
  10. Services = ConfigureServices ();
  11. Application.Init ();
  12. Application.Run (Services.GetRequiredService<LoginView> ());
  13. Application.Top?.Dispose ();
  14. Application.Shutdown ();
  15. }
  16. private static IServiceProvider ConfigureServices ()
  17. {
  18. var services = new ServiceCollection ();
  19. services.AddTransient<LoginView> ();
  20. services.AddTransient<LoginViewModel> ();
  21. return services.BuildServiceProvider ();
  22. }
  23. }