public void UpdateParameter(IParameterBox iparameterbox, object value) { // Parameter from Vehicle Fractions have a Type in their Tag // We use this to determine where the parameter needs to be written var type = iparameterbox.Tag as Type; if (type != null) { vehiclefractiondictionary[type] = (int) value; if (VehicleFractionChanged != null) VehicleFractionChanged(null, new ParameterEventArgs(iparameterbox.Name, value)); } else { PropertyInfo propertyinfo = typeof (ParameterPanel).GetProperty(iparameterbox.Name); if (propertyinfo != null) propertyinfo.SetValue(null, value, null); } }
private IParameterBox setiparameterbox(IParameterBox iparameterbox) { // All IParameterBoxes have these properties, so we'll put it in an explicit method. iparameterbox.Dock = DockStyle.Fill; iparameterbox.SetIParameterContainer(this); iparameterbox.KeyPress += control_KeyPress; iparameterbox.StatusChanged += mainform.ExtendedStatusStrip.UpdateStatus; iparameterboxdictionary.Add(iparameterbox.Name, iparameterbox); iparameterboxlist.Add(iparameterbox); SetCellPosition((Control) iparameterbox, new TableLayoutPanelCellPosition(1, RowStyles.Count - 1)); Controls.Add((Control) iparameterbox); return iparameterbox; }
public IParameterBox Next(IParameterBox parametertextbox) { // Our answer to GetNextControl of a normal Control. At the time of writing we didn't realise the method existed // and now we'll keep it here in case we'll ever be want to be able to exclude parametertextboxes int min = (iparameterboxlist.IndexOf(parametertextbox) + 1)%iparameterboxlist.Count; int max = min + iparameterboxlist.Count; for (int i = min; i < max; i++) if (iparameterboxlist[i%iparameterboxlist.Count].Enabled) return iparameterboxlist[i%iparameterboxlist.Count]; return parametertextbox; }