Ejemplo n.º 1
0
 public QLearningHandler(IEventAggregator eventAggregator, IStateHelper stateHelper, IColorHelper colorHelper)
 {
     EventAggregator = eventAggregator;
     StateHelper     = stateHelper;
     ColorHelper     = colorHelper;
     Randomizer      = new Random();
 }
Ejemplo n.º 2
0
 public ValidateHeaderHandler
 (
     IHttpContextAccessor httpContextAccessor,
     IStateHelper stateHelper
 )
 {
     _httpContextAccessor = httpContextAccessor;
     _stateHelper         = stateHelper;
 }
Ejemplo n.º 3
0
 public void Setup()
 {
     _categoryRepo = DependencyResolver.Container.GetInstance<ICategoryRepositoryAsync>();
     _commandBus = DependencyResolver.Container.GetInstance<ICommandBus>();
     _eventBus = DependencyResolver.Container.GetInstance<IEventBus>();
     _userCategoryRepository = DependencyResolver.Container.GetInstance<IRepository<UserCategory>>();
     _eventHandlerFactory = DependencyResolver.Container.GetInstance<IEventHandlerFactory>();
     _stateHelper = DependencyResolver.Container.GetInstance<IStateHelper>();
     _aggregateRepository = DependencyResolver.Container.GetInstance<IAggregateRepositoryAsync>();
     _eventRepository = DependencyResolver.Container.GetInstance<IEventRepositoryAsync>();
     _mementoRepository = DependencyResolver.Container.GetInstance<IMementoRepositoryAsync>();
     _questionRepository = DependencyResolver.Container.GetInstance<IQuestionRepositoryAsync>();
 }
Ejemplo n.º 4
0
 public void Setup()
 {
     _categoryRepo           = DependencyResolver.Container.GetInstance <ICategoryRepositoryAsync>();
     _commandBus             = DependencyResolver.Container.GetInstance <ICommandBus>();
     _eventBus               = DependencyResolver.Container.GetInstance <IEventBus>();
     _userCategoryRepository = DependencyResolver.Container.GetInstance <IRepository <UserCategory> >();
     _eventHandlerFactory    = DependencyResolver.Container.GetInstance <IEventHandlerFactory>();
     _stateHelper            = DependencyResolver.Container.GetInstance <IStateHelper>();
     _aggregateRepository    = DependencyResolver.Container.GetInstance <IAggregateRepositoryAsync>();
     _eventRepository        = DependencyResolver.Container.GetInstance <IEventRepositoryAsync>();
     _mementoRepository      = DependencyResolver.Container.GetInstance <IMementoRepositoryAsync>();
     _questionRepository     = DependencyResolver.Container.GetInstance <IQuestionRepositoryAsync>();
 }
Ejemplo n.º 5
0
        protected void Application_Start()
        {
            Bootstrapper.BootstrapStructureMap();
            GlobalConfiguration.Configure(WebApiConfig.Register);

            if (ConfigurationManager.AppSettings["RestoreStateOnAppStart"] != null && ConfigurationManager.AppSettings["RestoreStateOnAppStart"].ToUpper() == "TRUE")
            {
                //Force drop db
                QuestionsDbContext.Drop();

                IStateHelper sh = Crucial.Framework.IoC.StructureMapProvider.DependencyResolver.Container.GetInstance <IStateHelper>();
                sh.RestoreState();
            }
        }
Ejemplo n.º 6
0
 public ModelBase(string stateSaveId, IStateHelper stateHelper)
 {
     StateSavedId = stateSaveId;
     StateHelper  = stateHelper;
 }
Ejemplo n.º 7
0
 public CanvasHelper(IStateHelper stateHelper, IRewardHelper rewardHelper, IColorHelper colorHelper)
 {
     StateHelper  = stateHelper;
     RewardHelper = rewardHelper;
     ColorHelper  = colorHelper;
 }
Ejemplo n.º 8
0
 public AuthenticationController(IHttpClientFactory httpClientFactory, IStateHelper stateHelper, IStringLocalizer <AuthenticationController> localizer)
 {
     _httpClientFactory = httpClientFactory;
     _stateHelper       = stateHelper;
     _localizer         = localizer;
 }
Ejemplo n.º 9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IStateHelper stateHelper)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseSession();

            // If state data is available in cookie, add it to the session
            // User checked the remember me checkbox
            // ===========================================================

            app.Use(async delegate(HttpContext context, Func <Task> next)
            {
                if (context.Request.GetStateData("StateData") != null)
                {
                    stateHelper.SetState(context.Request.GetStateData("StateData"));
                }
                await next.Invoke().ConfigureAwait(false);
            });


            // Start Localization
            // ==================

            // Get language preference from cookie and set in session
            app.Use(async delegate(HttpContext context, Func <Task> next)
            {
                if (context.Request.Cookies.ContainsKey("culture"))
                {
                    string culture = context.Request.Cookies["culture"];
                    context.Session.SetString("culture", culture);
                }
                await next.Invoke().ConfigureAwait(false);
            });

            // Configure Localization options
            var supportedCultures = new[]
            {
                new CultureInfo("en-US"),
                new CultureInfo("nl"),
            };
            var localizationOptions = new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture("en-US"),
                SupportedCultures     = supportedCultures,
                SupportedUICultures   = supportedCultures
            };

            localizationOptions.RequestCultureProviders.Clear();
            localizationOptions.RequestCultureProviders.Add(new CultureProviderResolverService());
            app.UseRequestLocalization(localizationOptions);

            // End Localization
            // ================

            app.UseHttpsRedirection();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "MyArea",
                    pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
 public AuthenticationController(IHttpClientFactory httpClientFactory, IStateHelper stateHelper)
 {
     _httpClientFactory = httpClientFactory;
     _stateHelper       = stateHelper;
 }
Ejemplo n.º 11
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IStateHelper stateHelper)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();
            app.UseSession();

            app.Use(async delegate(HttpContext context, Func <Task> next)
            {
                if (context.Request.GetStateData("StateData") != null)
                {
                    stateHelper.SetState(context.Request.GetStateData("StateData"));
                }
                await next.Invoke().ConfigureAwait(false);
            });

            // Start Localization
            // ==================

            // Get language preference from cookie and set in session
            app.Use(async delegate(HttpContext context, Func <Task> next)
            {
                if (context.Request.Cookies.ContainsKey("culture"))
                {
                    string culture = context.Request.Cookies["culture"];
                    context.Session.SetString("culture", culture);
                }
                await next.Invoke().ConfigureAwait(false);
            });

            // Configure Localization options
            var supportedCultures = new[]
            {
                new CultureInfo("en-US"),
                new CultureInfo("nl"),
            };
            var localizationOptions = new RequestLocalizationOptions
            {
                DefaultRequestCulture = new RequestCulture("en-US"),
                SupportedCultures     = supportedCultures,
                SupportedUICultures   = supportedCultures
            };

            localizationOptions.RequestCultureProviders.Clear();
            localizationOptions.RequestCultureProviders.Add(new CultureProviderResolverService());
            app.UseRequestLocalization(localizationOptions);

            // End Localization
            // ================

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }