/// <summary> /// Present a dialog to add a parameter to RebarShapeDef. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void addParameterButton_Click(object sender, EventArgs e) { using (AddParameter addParam = new AddParameter(m_rebarShapeDef.Parameters)) { if (DialogResult.OK == addParam.ShowDialog()) { Type paramType = addParam.IsFormula ? typeof(RebarShapeParameterFormula) : typeof(RebarShapeParameterDouble); object paramName = addParam.ParamName; object paramValue = addParam.ParamValue; if (!addParam.IsFormula) { paramValue = double.Parse(addParam.ParamValue); } // Add the parameter to RebarShapeDef. RebarShapeParameter param = m_rebarShapeDef.AddParameter(paramType, paramName, paramValue); propertyGrid.SelectedObject = param; m_parametersListBoxBinding.ResetBindings(false); parameterListBox.SelectedItem = param; } } }
/// <summary> /// Present a dialog to add a parameter to RebarShapeDef. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void addParameterButton_Click(object sender, EventArgs e) { using (AddParameter addParam = new AddParameter(m_rebarShapeDef.Parameters)) { if( DialogResult.OK == addParam.ShowDialog()) { Type paramType = addParam.IsFormula ? typeof(RebarShapeParameterFormula) : typeof(RebarShapeParameterDouble); object paramName = addParam.ParamName; object paramValue = addParam.ParamValue; if (!addParam.IsFormula) paramValue = double.Parse(addParam.ParamValue); // Add the parameter to RebarShapeDef. RebarShapeParameter param = m_rebarShapeDef.AddParameter(paramType, paramName, paramValue); propertyGrid.SelectedObject = param; m_parametersListBoxBinding.ResetBindings(false); parameterListBox.SelectedItem = param; } } }