コード例 #1
0
        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);
        }
コード例 #2
0
        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();
        }
コード例 #3
0
ファイル: App.cs プロジェクト: spud-ninja/spud-200729-demo
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: App.cs プロジェクト: yenicead/BlazorMobileApp
        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);
        }