/// <summary> /// On updates. /// </summary> protected override void Update(double deltaTime) { // if user click 'exit' action, exit game if (Input.Down("exit")) { Game.Exit(); } // find selected demo var mousePos = Input.CursorPosition; _selected = null; foreach (var demo in _demos) { if (demo.Region.Contains(mousePos)) { _selected = demo; break; } } // select demo to play if (Input.ReleasedNow(KeyCodes.MouseLeft) && _selected != null) { Game.ChangeScene(_selected.Scene); _cursor.Dispose(); _font.Dispose(); _fontBig.Dispose(); Assets.ClearCache(); } }
// **************************************************************************** // GENUS // **************************************************************************** public DemoContainer Demo() { DemoContainer demoContainer = new DemoContainer(); demoContainer.CropsForCWR = _cropForCwrDAO.Demo(); demoContainer.Species = _speciesDAO.Demo(); demoContainer.CWRTraits = _cwrTraitDAO.Demo(); return(demoContainer); }
public void ResolveSingleObject() { DemoContainer demoContainer = new DemoContainer(); demoContainer.Register(typeof(IHello), typeof(Hello)); var impl = demoContainer.Resolve(typeof(IHello)); Assert.IsType <Hello>(impl); }
public HomeController(DemoContainer demoContainer, UserIdContainer userId, DatabaseLinks databaseLinks, DatabaseSetup databaseSetup, Settings settings, ILogger <HomeController> logger, IHostingEnvironment hostingEnv) { _demoContainer = demoContainer; _userId = userId; _databaseSetup = databaseSetup; _databaseLinks = databaseLinks; _settings = settings; _logger = logger; _hostingEnv = hostingEnv; }
public void ResolveObjectWithDependency() { DemoContainer demoContainer = new DemoContainer(); demoContainer.Register(typeof(IHello), typeof(Hello2)); demoContainer.Register(typeof(ISomething), typeof(Something)); var impl = demoContainer.Resolve(typeof(IHello)); Assert.IsType <Hello2>(impl); Assert.Equal("Hello, I did something", ((Hello2)impl).SayHello()); }
public void Init() { var container = new DemoContainer(); container.Register <IConsole>(delegate { return(fileConsole); }); container.Register <Profile>(delegate { return(new Profile( container.Create <IConsole>())); }); profile = container.Create <Profile>(); }
public void ConfigureServices(IServiceCollection services) { services.AddHttpContextAccessor(); var settings = new Settings(); Configuration.Bind(settings); services.AddSingleton <Settings>(settings); services.AddMemoryCache(); // In production, the React files will be served from this directory services.AddSpaStaticFiles(configuration => { configuration.RootPath = GetSpaOutputDir(HostingEnvironment); }); var demoContainer = DemoContainer.Initialize(DemoCodePaths, LoggerFactory.CreateLogger <DemoContainer>(), settings); services.AddSingleton(demoContainer); services.AddSingleton <DocumentStoreHolder>(); services.AddSingleton(_ => new DatabaseName(settings.Database, settings.ConferenceMode)); services.AddScoped <UserStoreCache>(); services.AddScoped <MediaStoreCache>(); services.AddScoped <HeadersAccessor>(); services.AddScoped <UserIdContainer>(); services.AddScoped <DatabaseSetup>(); services.AddScoped <DatabaseLinks>(); services.AddScoped <AddUserIdToResponseHeaderAttribute>(); services .AddControllers() .AddApplicationPart(typeof(Startup).Assembly) .AddControllersAsServices(); services.AddHsts(options => { options.MaxAge = TimeSpan.FromDays(365); }); }
public void ConfigureServices(IServiceCollection services) { services.AddHttpContextAccessor(); var settings = new Settings(); Configuration.Bind(settings); services.AddSingleton <Settings>(settings); var serviceProvider = services.BuildServiceProvider(); services.AddMemoryCache(); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); // In production, the React files will be served from this directory services.AddSpaStaticFiles(configuration => { configuration.RootPath = GetSpaOutputDir(HostingEnvironment); }); var demoContainer = DemoContainer.Initialize(DemoCodePaths, LoggerFactory.CreateLogger <DemoContainer>(), settings); services.AddSingleton(demoContainer); services.AddSingleton <DocumentStoreHolder>(); services.AddSingleton(_ => new DatabaseName(settings.Database, settings.ConferenceMode)); services.AddScoped <UserStoreCache>(); services.AddScoped <MediaStoreCache>(); services.AddScoped <HeadersAccessor>(); services.AddScoped <UserIdContainer>(); services.AddScoped <DatabaseSetup>(); services.AddScoped <DatabaseLinks>(); services.AddScoped <AddUserIdToResponseHeaderAttribute>(); }