public static void OnStartupProxy <TStartupWindow>(this IDIApplication application) where TStartupWindow : Window { IServiceCollection services = new ServiceCollection(); application.Configuration = new ConfigurationBuilder() .AddJsonFile("appsettings", true, true) .Build(); services.AddSingleton(application.Configuration); application.ConfigureServices(services); application.ServiceProvider = services.BuildServiceProvider(); application.ServiceProvider.GetRequiredService <TStartupWindow>().Show(); }
public static TWindow GetWindow <TWindow>(this IDIApplication application) where TWindow : Window => application.ServiceProvider.GetRequiredService <TWindow>();