Ejemplo n.º 1
0
        public static async Task Main(string[] args)
        {
            var apiUrl = "https://api.blazor.ninja";

            // TODO Paste your app token below
            var appToken = "eyJ0eXAiOiJDU1AiLCAiZW5jIjoiUlNBX09BRVAifQ.AKlw3OJSfuEPNSzGT72CL0QQWhUQe2iLyMEv7F-q6j9M6_LLcXYNgA5b5Xl2p-6lOQUq-GAF3peBSyXR_f5ANpHinydE_MKROfrz39xiOXDO9duhVNJHUiQ6BoPzrop-nTATO5O331HDepU-pd1EzaLkUbtj8YRg2CIRhHKydaM.Q9pYG1eESeStPAq3.t1PGIguzLp7_j76FaTgR5bO4RUvslSk5eJYcGbxvLn9yj5sWqpAWYBOA_-26Xw.sJ9wUdLl8vS6uXwStXdbgA";

            var builder = WebAssemblyHostBuilder.CreateDefault(args);

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

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

            builder.Services.AddStorage();

            var proxyFactory = new HttpProxyFactory(apiUrl, appToken);

            builder.Services.AddSingleton <IProxyFactory>(proxyFactory);

            var configurationProxy = new HttpConfigurationProxy(apiUrl, appToken);
            await Task.WhenAll(new List <Task>
            {
                Task.Run(async() => await configurationProxy.GetNamespaceAsync(UserNamespace.Label)),
                Task.Run(async() => await configurationProxy.GetFeatureAsync <OnboardingFeature>()),
                Task.Run(async() => await configurationProxy.GetFeatureAsync <PostboardingFeature>()),
                Task.Run(async() => await configurationProxy.GetFeatureAsync <ThemeFeature>())
            });

            builder.Services.AddSingleton <IConfigurationProxy>(configurationProxy);

            await builder.Build().RunAsync();
        }
Ejemplo n.º 2
0
        public static async Task Main(string[] args)
        {
            var apiUrl = "https://api.blazor.ninja";

            // TODO Paste your app token below
            var appToken = "eyJ0eXAiOiJDU1AiLCAiZW5jIjoiUlNBX09BRVAifQ.AKlw3OJSfuEPNSzGT72CL0QQWhUQe2iLyMEv7F-q6j9M6_LLcXYNgA5b5Xl2p-6lOQUq-GAF3peBSyXR_f5ANpHinydE_MKROfrz39xiOXDO9duhVNJHUiQ6BoPzrop-nTATO5O331HDepU-pd1EzaLkUbtj8YRg2CIRhHKydaM.Q9pYG1eESeStPAq3.t1PGIguzLp7_j76FaTgR5bO4RUvslSk5eJYcGbxvLn9yj5sWqpAWYBOA_-26Xw.sJ9wUdLl8vS6uXwStXdbgA";

            ProxyFactory = new HttpProxyFactory(apiUrl, appToken);

            ConfigurationProxy = new HttpConfigurationProxy(apiUrl, appToken);
            await Task.WhenAll(new List <Task>
            {
                Task.Run(async() => await ConfigurationProxy.GetNamespaceAsync(UserNamespace.Label)),
                Task.Run(async() => await ConfigurationProxy.GetFeatureAsync <OnboardingFeature>()),
                Task.Run(async() => await ConfigurationProxy.GetFeatureAsync <PostboardingFeature>()),
                Task.Run(async() => await ConfigurationProxy.GetFeatureAsync <ThemeFeature>())
            });

            await CreateHostBuilder(args).Build().RunAsync();
        }