Program.cs 864 B

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