This form provides an entrance for user to add parameters to RebarShape.
Inheritance: System.Windows.Forms.Form
示例#1
0
        /// <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;
                }
            }
        }
示例#2
0
        /// <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;
                }
            }
        }