private void addMlSettingsBoxContent() { MachineLearning.Learning.ML_Settings settingsObject = new MachineLearning.Learning.ML_Settings(); FieldInfo[] fields = settingsObject.GetType().GetFields(); for (int i = 0; i < fields.Length; i++) { Label l = new Label(); mlSettingsPanel.Controls.Add(l); l.AutoSize = true; l.Location = new System.Drawing.Point(5, 5 + ML_FIELDS_OFFSET * i); l.Name = fields[i].Name + "_label"; l.Size = new System.Drawing.Size(50, 15); l.TabIndex = i * 2; l.Text = fields[i].Name; TextBox t = new TextBox(); mlSettingsPanel.Controls.Add(t); t.Location = new System.Drawing.Point(150, 5 + ML_FIELDS_OFFSET * i); t.Name = fields[i].Name + "_textBox"; t.Size = new System.Drawing.Size(150, 15); t.TabIndex = i * 2 + 1; t.Text = fields[i].GetValue(settingsObject).ToString(); } }
private void setMLSettings() { MachineLearning.Learning.ML_Settings setting = new MachineLearning.Learning.ML_Settings(); foreach (Control c in mlSettingsPanel.Controls) { if (c.Name.EndsWith("_textBox")) { string fieldName = c.Name.Substring(0, c.Name.Length - "_textBox".Length); setting.setSetting(fieldName, ((TextBox)c).Text); } } cmd.performOneCommand(Commands.COMMAND_SET_MLSETTING + " " + setting.ToString()); }
private void setMLSettings() { MachineLearning.Learning.ML_Settings setting = new MachineLearning.Learning.ML_Settings(); foreach (Control c in mlSettingsPanel.Controls) { if (c.Name.EndsWith("_textBox")) { string fieldName = c.Name.Substring(0, c.Name.Length - "_textBox".Length); setting.setSetting(fieldName, ((TextBox)c).Text); } } cmd.performOneCommand(Commands.COMMAND_SET_MLSETTING+" "+setting.ToString()); }