public App() { BlazorHybridHost.AddResourceAssembly(GetType().Assembly, contentRoot: "WebUI/wwwroot"); var host = MobileBlazorBindingsHost.CreateDefaultBuilder() .ConfigureServices((hostContext, services) => { // Adds web-specific services such as NavigationManager services.AddBlazorHybrid(); // Register app-specific services services.AddSingleton <CounterState>(); services.AddSingleton <AppState>(); services.AddOptions(); services.AddAuthorizationCore(); services.AddScoped <CustomStateProvider>(); services.AddScoped <AuthenticationStateProvider>(s => s.GetRequiredService <CustomStateProvider>()); services.AddScoped <IAuthService, AuthService>(); }) .Build(); MainPage = new ContentPage { Title = "My Application" }; host.AddComponent <Main>(parent: MainPage); }
public MainPage() { BlazorHybridHost.AddResourceAssembly(GetType().Assembly, contentRoot: "WebUI/wwwroot"); var serviceCollection = new ServiceCollection(); serviceCollection.AddBlazorHybrid(); serviceCollection.AddLogging(); serviceCollection.AddSingleton <AppState>(); BlazorHybridDefaultServices.Instance = serviceCollection.BuildServiceProvider(); InitializeComponent(); MasterDetails.IsPresented = false; WorkaroundDisplayIssue(); }
public App() { BlazorHybridHost.AddResourceAssembly(typeof(App).Assembly, contentRoot: "WebUI/wwwroot"); var host = MobileBlazorBindingsHost.CreateDefaultBuilder() .ConfigureServices((hostContext, services) => { services.AddBlazorHybrid(); services.AddSingleton <BlazorLib.State.CounterState>(); }) .Build(); MainPage = new ContentPage { Title = "My Application" }; host.AddComponent <Main>(parent: MainPage); }
public App() { BlazorHybridHost.AddResourceAssembly(GetType().Assembly, contentRoot: "WebUI/wwwroot"); var host = MobileBlazorBindingsHost.CreateDefaultBuilder() .ConfigureServices((hostContext, services) => { // Adds web-specific services such as NavigationManager services.AddBlazorHybrid(); // Register app-specific services services.AddSingleton <CounterState>(); }) .Build(); MainPage = new ContentPage { Title = "My Application" }; host.AddComponent <Main>(parent: MainPage); }
public App() { BlazorHybridHost.AddResourceAssembly(GetType().Assembly, contentRoot: "WebUI/wwwroot"); var host = MobileBlazorBindingsHost.CreateDefaultBuilder() .ConfigureServices((hostContext, services) => { // Adds web-specific services such as NavigationManager services.AddBlazorHybrid(); services.AddScoped(sp => new HttpClient { BaseAddress = new Uri("https://localhost:44343/") }); }) .Build(); MainPage = new ContentPage { Title = "First Blazor Mobile Application" }; host.AddComponent <Main>(parent: MainPage); }