public void SaveResultsToXml(XmlElement eConfig, out string strDefaultAnnotation) { saveSubForComboBox(comboBoxExePathField, eConfig, Constants.EXEPATHFIELDKEY, Constants.DEFAULTEXEPATHFIELD); saveSubForCheckedListBox(checkedListBoxSelectedCols, eConfig, Constants.SELECTEDCOLSKEY); saveSubForCheckbox(checkBoxAutoEscape, eConfig, Constants.AUTOESCAPEKEY, Constants.DEFAULTAUTOESCAPE); // Output Fields XmlElement xe = XmlHelpers.GetOrCreateChildNode(eConfig, Constants.STDOUTFIELDKEY); string stdOutField = textBoxStdOutField.Text; xe.InnerText = string.IsNullOrWhiteSpace(stdOutField) ? Constants.DEFAULTSTDOUTFIELD : stdOutField; xe = XmlHelpers.GetOrCreateChildNode(eConfig, Constants.RETCODEFIELDKEY); string retCodeField = textBoxRetCodeField.Text; xe.InnerText = string.IsNullOrWhiteSpace(retCodeField) ? Constants.DEFAULTRETCODEFIELD : retCodeField; xe = XmlHelpers.GetOrCreateChildNode(eConfig, Constants.EXCEPTIONFIELDKEY); string exceptionField = textBoxExceptionField.Text; xe.InnerText = string.IsNullOrWhiteSpace(exceptionField) ? Constants.DEFAULTEXCEPTIONFIELD : exceptionField; xe = XmlHelpers.GetOrCreateChildNode(eConfig, Constants.DIAGNOSTICFIELDKEY); string diagnosticField = textBoxDiagnosticField.Text; xe.InnerText = string.IsNullOrWhiteSpace(diagnosticField) ? Constants.DEFAULTDIAGNOSTICFIELD : diagnosticField; // Set the default annotation. strDefaultAnnotation = "ProcessRunner"; }
private void saveSubForCheckbox(CheckBox cb, XmlElement eConfig, string key, string valueDefault) { XmlElement xe = XmlHelpers.GetOrCreateChildNode(eConfig, key); if (cb.Checked == true) xe.InnerText = "Y"; else xe.InnerText = "N"; }
private void saveSubForCheckedListBox(CheckedListBox box, XmlElement eConfig, string key) { XmlElement xe = XmlHelpers.GetOrCreateChildNode(eConfig, key); List<string> selectedCols = new List<string>(); foreach (var item in box.CheckedItems) { string selectedCol = item.ToString(); // Drop the " (Missing)" suffix if it is appended if (selectedCol.EndsWith(MISSING)) selectedCol = selectedCol.Substring(0, selectedCol.Length - MISSING.Length); selectedCols.Add(selectedCol); } if (selectedCols.Count() == 0) xe.InnerText = Constants.ZEROSELECTEDCOLS; else xe.InnerText = string.Join(",", selectedCols); }
private void saveSubForComboBox(ComboBox cbox, XmlElement eConfig, string key, string valueDefault) { XmlElement xe = XmlHelpers.GetOrCreateChildNode(eConfig, key); var selectedItem = cbox.SelectedItem; xe.InnerText = selectedItem == null ? valueDefault : selectedItem.ToString(); }