/// <summary> /// Activates Blazor components, activates the <see cref="CurrentApp"/>, and starts a call to <see cref="WebAssemblyHost.RunAsync"/>. /// </summary> /// <param name="args"><see cref="string"/> arguments captured by the launch of ths <see cref="BlazorApplication"/>.</param> public async Task ActivateAsync <TApp>(string[] args) where TApp : IComponent { var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.ConfigureContainer(new AutofacServiceProviderFactory(b => CurrentApp.SetupContainer(b, new BlazorAppPlatform(), PlatformAssemblies))); builder.RootComponents.Add <TApp>("#app"); builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); builder.Services.AddBlazoredLocalStorage(); var app = builder.Build(); CurrentApp.Services = app.Services.GetAutofacRoot(); await app.RunAsync(); }