예제 #1
0
        public static async Task Main(string[] args)
        {
            var builder = WebAssemblyHostBuilder.CreateDefault(args);

            builder.RootComponents.Add <MatBlazor.Doc.DocApp>("app");
            var services = builder.Services;

            services.AddTransient(sp => new HttpClient
            {
                BaseAddress = new Uri(builder.HostEnvironment.BaseAddress)
            });


            var useNew = Environment.GetEnvironmentVariable("USE_NEW") == "true";

            if (useNew)
            {
                services.AddDocApp(new AppModel(typeof(DocDemoIndex), new NavModel("My Library - Documentation"), false));
            }
            else
            {
                services.AddDocApp(new AppModel(typeof(MatBlazorDocIndex), DemoNavModel.Default()));
            }

            //builder.Services.AddDocApp(new AppModel(typeof(Pages.Index), DemoNavModel.Default()));
            services.AddScoped <DemoUserService>();


            await builder.Build().RunAsync();
        }
예제 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        // For more information on how to configure your application, visit https://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped <HttpClient>();

            services.AddMatBlazor();

            services.AddRazorPages();
            services.AddServerSideBlazor(c =>
            {
                c.DetailedErrors = true;
            });
            services.AddSignalR(c =>
            {
                c.EnableDetailedErrors      = true;
                c.StreamBufferCapacity      = Int32.MaxValue;
                c.MaximumReceiveMessageSize = long.MaxValue;
            });

            var useNew = Environment.GetEnvironmentVariable("USE_NEW") == "true";

            if (useNew)
            {
                services.AddDocApp(new AppModel(typeof(DocDemoIndex), new NavModel("My Library - Documentation"), false));
            }
            else
            {
                services.AddDocApp(new AppModel(typeof(MatBlazorDocIndex), DemoNavModel.Default()));
            }

            services.AddScoped <DemoUserService>();
        }