public static async Task Main(string[] args)
        {
            WebAssemblyHostBuilder builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <App>("#app");

            builder.Services.AddScoped(sp => new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });

            builder.Services.AddOidcAuthentication(options =>
            {
                builder.Configuration.Bind("Local", options.ProviderOptions);

                //options.ProviderOptions.Authority = "https://accounts.google.com/";
                //options.ProviderOptions.RedirectUri = "https://localhost:44333/authentication/login-callback";
                //options.ProviderOptions.PostLogoutRedirectUri = "https://localhost:44333/authentication/logout-callback";
                //options.ProviderOptions.ClientId = "953393400208-sab1pb4ga5jeie0g50ft6uumf4uqa6in.apps.googleusercontent.com";
                options.ProviderOptions.ResponseType = "id_token token";
                //options.ProviderOptions.DefaultScopes.Add("https://www.googleapis.com/auth/drive"); // See, edit, create, and delete all of your Google Drive files
                //options.ProviderOptions.DefaultScopes.Add("https://www.googleapis.com/auth/drive.appdata"); // See, create, and delete its own configuration data in your Google Drive
                options.ProviderOptions.DefaultScopes.Add("https://www.googleapis.com/auth/drive.file"); // See, edit, create, and delete only the specific Google Drive files you use with this app
                //options.ProviderOptions.DefaultScopes.Add("https://www.googleapis.com/auth/drive.install"); // Connect itself to your Google Drive
            });

            builder.Services.AddServices();

            WebAssemblyHost host = builder.Build();

            await host.Services.UseServices();

            await host.RunAsync();
        }
Beispiel #2
0
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <App>("app");

            builder.Services.AddScoped(sp => new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });
            //builder.Services.AddScoped<IPhilipsHueService, PhilipsHueService>();
            builder.Services.AddScoped <IPhilipsHueService, DesignPhilipsHueService>();

            builder.Services.AddBlazorise(options =>
            {
                options.ChangeTextOnKeyPress = true;
            })
            .AddBootstrapProviders()
            .AddFontAwesomeIcons();

            WebAssemblyHost host = builder.Build();

            host.Services
            .UseBootstrapProviders()
            .UseFontAwesomeIcons();

            await host.RunAsync();
        }
Beispiel #3
0
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <App>("#app");

            builder.Services.AddScoped(sp => new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });
            ConfigureServices(builder.Services);

            WebAssemblyHost host    = builder.Build();
            var             js      = host.Services.GetRequiredService <IJSRuntime>();
            string          culture = await js.InvokeAsync <string>("getFromLocalStorage", "culture");

            CultureInfo selectedCulture;

            if (culture == null)
            {
                selectedCulture = new CultureInfo("en-US");
            }
            else
            {
                selectedCulture = new CultureInfo(culture);
            }

            CultureInfo.DefaultThreadCurrentCulture   = selectedCulture;
            CultureInfo.DefaultThreadCurrentUICulture = selectedCulture;
            await host.RunAsync();

            //await builder.Build().RunAsync();
        }
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            AddLoggingAndApplicationInsights(builder);

            builder.RootComponents.Add <App>("app");

            builder.Services.AddSingleton(new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });
            builder.Services.AddScoped(typeof(AccountClaimsPrincipalFactory <RemoteUserAccount>), typeof(RolesAccountClaimsPrincipalFactory));            // multiple roles workaround
            builder.Services.AddApiAuthorization();

            builder.Services.AddLocalization();
            builder.Services.AddGeneratedResourceWrappers();

            builder.Services.AddBlazoredLocalStorage();

            builder.Services.AddHxMessenger();
            builder.Services.AddHxMessageBoxHost();
            SetHxComponents();

            builder.Services.AddScoped <IContactReferenceDataStore, ContactReferenceDataStore>();

            AddGrpcClient(builder);

            WebAssemblyHost webAssemblyHost = builder.Build();

            await SetLanguage(webAssemblyHost);

            await webAssemblyHost.RunAsync();
        }
Beispiel #5
0
        public static async Task Main(string[] args)
        {
            WebAssemblyHost host = CreateHostBuilder(args).Build();

            await Initialize(host);

            await host.RunAsync();
        }
        public static async Task Main(string[] args)
        {
            _builder = WebAssemblyHostBuilder.CreateDefault(args);
            _builder.RootComponents.Add <App>("app");
            ConfigureServices(_builder.Services);
            await ConfigureApplication(_builder.Services);

            await _host.RunAsync();
        }
Beispiel #7
0
        public static async Task Main(string[] args)
        {
            WebAssemblyHost webAssemblyHost = CreateWebHost(args);

            ApplicationData.ServiceProvider = webAssemblyHost.Services;
            await InitHttpManage();

            ConsoleHelperBase.StartWrite();
            await webAssemblyHost.RunAsync();
        }
Beispiel #8
0
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <App>("app");

            ConfigureServices(builder.Services, builder);

            WebAssemblyHost host = builder.Build();

            await host.RunAsync();
        }
Beispiel #9
0
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <DragonFly.App.Client.App>("app");

            builder.AddDragonFlyClient();

            WebAssemblyHost build = builder.Build();

            build.UseDragonFlyClient();

            await build.RunAsync();
        }
Beispiel #10
0
        public static Task Main(string[] aArgumentArray)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(aArgumentArray);

            builder.RootComponents.Add <App>("#app");
            builder.Services.AddScoped
                (_ => new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });

            ConfigureServices(builder.Services);

            WebAssemblyHost host = builder.Build();

            return(host.RunAsync());
        }
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <App>("app");

            builder.Services.AddTransient(sp => new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });
            LazyLoadServicesBuilder lazyLoadServicesBuilder = builder.Services.AddLazyLoad <AreaAssemblyLazyLoadResolver>();

            WebAssemblyHost host = builder.Build();

            lazyLoadServicesBuilder.SetHost(host);
            await host.RunAsync();
        }
Beispiel #12
0
        public async static Task Main(string[] args)
        {
            // Configure.
            WebAssemblyHostBuilder builder = WebAssemblyHostBuilder.CreateDefault();

            ConfigureServices(builder.Services);
            ConfigureComponents(builder.RootComponents);

            // Startup.
            WebAssemblyHost host = builder.Build();

            StartupServices(host.Services);

            // Run.
            await host.RunAsync();
        }
Beispiel #13
0
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.Services
            .AddBlazorise(o => { o.ChangeTextOnKeyPress = true; })
            .AddBootstrapProviders()
            .AddFontAwesomeIcons()
            .AddScoped(sp => new HttpClient
            {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            })
            .AddTransient <IPlayersClientService, PlayersClientService>()
            .AddTransient <IRankingsClientService, RankingsClientService>()
            .AddTransient <ICurrentCultureService, CurrentCultureService>()
            .AddTransient <IGameService, GameClientService>()
            .AddTransient <ICalendarService, CalendarService>()
            .AddTransient <CareerDateService>()
            .AddScoped <IToasterService, ToasterService>()
            .AddBlazoredLocalStorage(config =>
            {
                config.JsonSerializerOptions.AllowTrailingCommas = true;
                config.JsonSerializerOptions.WriteIndented       = true;
            })
            .AddLocalization()
            ;

            var configuration = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile <ClientMappingProfile>();
            });

            builder.Services.AddSingleton(configuration.CreateMapper());

            builder.RootComponents.Add <App>("#app");

            WebAssemblyHost host = builder.Build();

            await SetCurrentCulture(host);

            host.Services
            .UseBootstrapProviders()
            .UseFontAwesomeIcons();

            await host.RunAsync();
        }
Beispiel #14
0
        public static async Task Main(string[] args)
        {
            WebAssemblyHostBuilder builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <App>("#app");

            builder.Services.AddScoped(sp => new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });
            builder.Services.AddSingleton <GameService>();

            WebAssemblyHost host = builder.Build();

            // Do any service initialization here

            await host.RunAsync();
        }
Beispiel #15
0
        public static async Task Main(string[] args)
        {
            GrpcChannel             channel = null;
            CancellationTokenSource cts     = new CancellationTokenSource();

            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <App>("app");

            builder.Services.AddSingleton <IDialogService, DialogServiceImplementation>();
            builder.Services.AddSingleton <IDialogServiceExt>(services => services.GetService <IDialogService>() as DialogServiceImplementation);

            builder.Services.AddSingleton <IWebSocketHandler, ClientWebSocketHandler>();

            builder.Services.AddSingleton(services =>
            {
                var httpHandler = new GrpcWebHandler(GrpcWebMode.GrpcWebText, new HttpClientHandler());

                channel = GrpcChannel.ForAddress("http://localhost:50080/", new GrpcChannelOptions {
                    HttpHandler = httpHandler
                });

                return(new AdminAccess.AdminAccessClient(channel));
            });

            builder.Services.AddTransient <IMainViewModel, MainViewModel>();
            builder.Services.AddTransient <CreateUserViewModel>();
            builder.Services.AddTransient <UsersListViewModel>();
            builder.Services.AddTransient <QueueViewModel>();
            builder.Services.AddTransient <ItemsViewModel>();



            await using WebAssemblyHost host = builder.Build();

            _ = (host.Services.GetService <IWebSocketHandler>() as ClientWebSocketHandler).RunAsync(cts.Token);
            await host.RunAsync();

            await channel?.ShutdownAsync();

            cts.Cancel();
        }
Beispiel #16
0
        public static async Task Main(string[] args)
        {
            WebAssemblyHostBuilder builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.Services
            .AddBlazorise(options =>
            {
                options.ChangeTextOnKeyPress = true;
            })
            .AddBootstrapProviders()
            .AddFontAwesomeIcons();

            builder.RootComponents.Add <App>("#app");

            builder.Services.AddScoped(sp => new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });

            builder.Services.AddScoped <IIndexedDbFactory, IndexedDbFactory>();

            builder.Services.AddScoped <IDatabaseAccess, DatabaseAccess>();

            builder.Services.AddScoped <JsInterop>();

            builder.Services.AddScoped <DataService>();

            builder.Services.AddScoped <State>();

            builder.Services.AddScoped <ThemeOptions>();

            WebAssemblyHost host = builder.Build();

            host.Services
            .UseBootstrapProviders()
            .UseFontAwesomeIcons();

            await host.Services.GetRequiredService <DataService>().LoadData();

            await host.RunAsync();
        }
Beispiel #17
0
        public async static Task Main(string[] args)
        {
            // Startups
            common   = new CommonStartup();
            accounts = new AccountsStartup();
            entries  = new EntriesStartup();
            sharing  = new SharingStartup();

            // Configure.
            WebAssemblyHostBuilder builder = WebAssemblyHostBuilder.CreateDefault();

            ConfigureServices(builder.Services);
            ConfigureComponents(builder.RootComponents);

            // Startup.
            WebAssemblyHost host = builder.Build();

            StartupServices(host.Services);

            // Run.
            await host.RunAsync();
        }
Beispiel #18
0
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <App>("#app");

            builder.Services.AddScoped(sp => new HttpClient {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });

            builder.Services.AddOptions();
            builder.Services.AddAuthorizationCore();
            builder.Services.AddScoped <AuthenticationStateProvider, SteamAuthProvider>();
            builder.Services.AddScoped <CartService>();
            builder.Services.AddTransient <StorageService>();
            builder.Services.AddTransient <ZIPService>();
            builder.Services.AddScoped <UserService>();
            builder.Services.AddBlazorTable();

            WebAssemblyHost host = builder.Build();
            await host.Services.GetRequiredService <CartService>().ReloadCartAsync();

            await host.RunAsync();
        }
Beispiel #19
0
 public static Task RunWithBootstrappersAsync(this WebAssemblyHost host)
 {
     return(BootstrapperUtilities
            .RunFromServiceProviderAsync(host.Services)
            .ContinueWith(x => host.RunAsync()));
 }