private void SetReusables(HttpContext context) { if (_cs != null) { return; } _cs = (ColourSquareGenerator)context.Cache["cs"]; if (_cs == null) { _cs = new ColourSquareGenerator(); } }
protected void btnStart_Click(object sender, EventArgs e) { double startOffset = Convert.ToDouble(ConfigurationManager.AppSettings["StartOffset"]); double adjustSize = Convert.ToDouble(ConfigurationManager.AppSettings["AdjustmentSize"]); _engine = new DataSetStepEngine(1, startOffset, adjustSize); Session["cengine"] = _engine; if (Cache.Get("cs") == null) { Cache["cs"] = new ColourSquareGenerator(); } Response.Redirect("~/StepPage.aspx?new=1"); }