Esempio n. 1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IChangeHandler sp)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            loggerFactory.AddConsole(Configuration.GetSection("Logging")); //log levels set in your configuration
            loggerFactory.AddDebug();                                      //does all log levels
            loggerFactory.AddSerilog();

            app.UseStaticFiles();
            app.UseSpaStaticFiles();
            app.AddSentryContext();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller}/{action=Index}/{id?}");
            });

            //thread that checks for document changes
            //use an Ihosted service for this instead
            Task.Factory.StartNew(sp.HandleUpdates,
                                  TaskCreationOptions.LongRunning);

            //app.UseCors("CorsPolicy");
            app.UseSignalR(rou =>
            {
                rou.MapHub <ProductHub>("/hubs/product");
            });

            app.UseSpa(spa =>
            {
                spa.Options.SourcePath = "ClientApp";

                if (env.IsDevelopment())
                {
                    spa.UseReactDevelopmentServer(npmScript: "start");
                }
            });
        }
 public Client(IChangeHandler handler)
 {
     handler.StatusChanged += Handler_StatusChanged;
 }