// This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();
            services.AddSignalR();

            services.AddCors(options =>
            {
                options.AddDefaultPolicy(builder =>
                {
                    builder
                    .AllowAnyHeader()
                    .AllowAnyMethod()
                    .AllowCredentials()
                    .WithOrigins("http://localhost:4200");
                });
            });

            services.AddSimpleInjector(_container, options =>
            {
                options.AddAspNetCore()
                .AddControllerActivation();
            });

            var types = _container.GetTypesToRegister <Hub>(GetType().Assembly);

            foreach (Type type in types)
            {
                _container.Register(type, type, Lifestyle.Singleton);
            }
            services.AddScoped(typeof(IHubActivator <>), typeof(SimpleInjectorHubActivator <>));

            var switcher = new BmdSwitcher.BmdSwitcher();

            switcher.Connect("192.168.0.137");
            _container.Register <Switcher>(() => switcher, Lifestyle.Singleton);
        }
Example #2
0
 public EffectBlockHandler(BmdSwitcher switcher)
 {
     this.switcher = switcher;
 }