protected void Application_Start(object sender, EventArgs e) { //App_Start Configuration WebApiConfig.Register(GlobalConfiguration.Configuration); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); // Inform the game loop about its environment GameLoop.Instance.MachineName = System.Environment.MachineName.ToLower(); GameLoop.Instance.VirtualPath = HostingEnvironment.ApplicationVirtualPath; GameLoop.Instance.SetEngine(); // Get latest codes from the WebService var dms = new DescilMturkService(new PersistedRepository()); dms.GetCodes(); try { using (var db = new PersistedRepository()) { db.Log.AddEvent("ApplicationStart"); } } catch { //Swallow this } }
protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.QueryString["key"])) { string key = Request.QueryString["key"]; var config = new Configuration(); if(key != config.AppSettings("SegregServiceKey")) { return; } } if (!string.IsNullOrEmpty(Request.QueryString["op"])) { string op = Request.QueryString["op"].ToLower(); switch (op) { case "reboot": HttpRuntime.UnloadAppDomain(); break; case "start": GameLoop.Instance.StartEngineLoop(); GameLoop.Instance.StartGameLoop(); //GameLoop.Instance.StartSweepLoop(); break; case "stop": GameLoop.Instance.StopEngineLoop(); GameLoop.Instance.StopGameLoop(); //GameLoop.Instance.StopSweepLoop(); break; case "startengineloop": GameLoop.Instance.StartEngineLoop(); break; case "stopengineloop": GameLoop.Instance.StopEngineLoop(); break; case "startgameloop": GameLoop.Instance.StartGameLoop(); break; case "stopgameloop": GameLoop.Instance.StopGameLoop(); break; case "startsweeploop": GameLoop.Instance.StartSweepLoop(); break; case "stopsweeploop": GameLoop.Instance.StopSweepLoop(); break; case "step": GameLoop.Instance.Step(); break; case "getcodes": var dms = new DescilMturkService(new PersistedRepository()); dms.GetCodes(); break; } } }
/// <summary> /// Fires on page load. /// </summary> protected void Page_Load(object sender, EventArgs e) { // Register client scripts // RegisterJs("~/bundles/welcome"); RegisterScript("~/scripts/segregwelcome.js"); // Process variables in query string ProcessQueryString(); if (!IsPostBack) { //Check access GetAccessCode(); // Grant or deny access if (IsAuthorized(AccessCode)) { PanelWelcome.Visible = true; PanelAccessDenied.Visible = false; } else { PanelWelcome.Visible = false; PanelAccessDenied.Visible = true; EventLog(AccessCode, "Access denied", "game"); } // Add access code to Viewstate LblAccessCode.Text = AccessCode; // Perform Checkin on the WebService var dms = new DescilMturkService(new PersistedRepository()); dms.Checkin(AccessCode); //Loggin PageLog(AccessCode, "welcome", WelcomeWizard.ActiveStepIndex); } }
public void DmsInit() { DMS = new DescilMturkService(db, DmsServiceUrl, DmsServiceKey, DmsProjectCode); }
/// <summary> /// Perform a checkout as soon as the turker arrives at the last page /// </summary> private void PerformCheckout() { var dms = new DescilMturkService(new PersistedRepository()); string accessCode = LblAccessCode.Text; string exitCode = TbExitCode.Text; double bonus = Convert.ToDouble(TbBonus.Text); dms.Checkout(accessCode, exitCode, bonus); }