/// <summary> /// Gets the value of the specified parameter /// </summary> /// <param name="paramDef">A <see cref="ParamDef"/> defining the parameter to get the value of.</param> /// <returns>The retrieved value.</returns> private object GetVal(ParamDef paramDef) { var obj = this.usedControls[paramDef.Name]; object val = null; switch (paramDef.Type) { case ParamType.Boolean: val = ((CheckBox)obj).Checked; break; case ParamType.Integer: val = ((NumericUpDown)obj).Value; break; case ParamType.String: val = ((TextBox)obj).Text; break; } return val; }
/// <summary> /// Defines a new parameter for this renamer and returns the defined parameter. /// </summary> /// <param name="name">The name by which the parameter should be accessed.</param> /// <param name="title">The title that should be shown for this parameter.</param> /// <param name="type">The type of parameter this is.</param> /// <param name="defaultValue">The default value for this parameter. This is a string, /// but should be parsable to the type used for this parameter.</param> /// <returns>The newly created parameter definition.</returns> protected ParamDef AddParamDef(string name, string title, ParamType type, string defaultValue = "", string intMaxValue = "100", string intMinValue = "0") { var paramDef = new ParamDef() { Name = name, Title = title, Type = type, DefaultValue = defaultValue, IntMinValue = intMinValue, IntMaxValue = intMaxValue }; this.parameterDefinitions.Add(name, paramDef); return paramDef; }