public override void SetSessionData(Boolean isInitial) { InitFields(Profile); if (!isInitial) { var propertiesDict = Flyer.GetType().GetProperties().Where(p => p.PropertyType == typeof(Boolean)).ToDictionary(p => p.Name, p => p); PropertyInfo pi; Boolean? @bool; foreach (String key in Request.Form) { if (propertiesDict.ContainsKey(key)) { pi = propertiesDict[key]; @bool = Request.ParseCheckboxValue(key); if (@bool.HasValue) { pi.SetValue(Flyer, @bool.Value, null); } } } Flyer.AmenitiesStepCompleted = true; } }
protected virtual Engine MakeEngines() { simRoot = new Engine(); simRoot.Name = "magicmirror.simroot"; physics = new Physics(); physics.Name = "magicmirrot.physics"; physics.Active = false; simRoot.Append(physics); scriptor = new Scriptor(); scriptor.Name = "magicmirror.scriptor"; simRoot.Append(scriptor); cameraController = new Transformer(); cameraController.Name = "magicmirror.camera.xform"; simRoot.Append(cameraController); if (!SuppressNavigation) { navigator = new Flyer(); if (typeof(Flyer).IsAssignableFrom(navigator.GetType())) { navigator.DegreesOfFreedom = Flyer.Y_ROT | Flyer.X_TRANS | Flyer.Y_TRANS | Flyer.Z_TRANS; navigator.Speed = 15.0f; } else { navigator.Speed = 0.1f; navigator.TurnSpeed *= 0.05f; } navigator.Name = "magicmirror.navigator"; navigator.SetFlags((uint)SharedObj.DOEVENTS); cameraController.Append(navigator); } return(simRoot); }
private void SetInputs() { var propertiesDict = Flyer.GetType().GetProperties().Where(p => p.PropertyType == typeof(Boolean)).ToDictionary(p => p.Name, p => p); HtmlInputCheckBox checkbox; PropertyInfo pi; foreach (Control control in form.Controls) { checkbox = control as HtmlInputCheckBox; if (checkbox != null && propertiesDict.ContainsKey(checkbox.Attributes["data-clientname"])) { pi = propertiesDict[checkbox.Attributes["data-clientname"]]; checkbox.Checked = (Boolean)pi.GetValue(Flyer, null); } } }