private void BtAdd_Click(object sender, EventArgs e) { try { NewBuild = new Build() { ID = txtDisplayName.Text.Trim() + txtLocation.Text.Trim(), DisplayName = txtDisplayName.Text.Trim(), Location = txtLocation.Text.Trim() }; this.DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show("ERROR: " + ex.Message); } }
public void AddBuild(Build build) { var existingBuild = xmlDocument.DocumentElement?.SelectSingleNode("./Builds/Build[@ID='" + build.ID + "']"); if (existingBuild != null) throw(new Exception("Build Already Exists")); var parentNode = xmlDocument.DocumentElement?.SelectSingleNode("./Builds"); var newBuild = xmlDocument.CreateElement("Build"); SetXmlAttribute(newBuild, "ID", build.ID); SetXmlAttribute(newBuild, "DisplayName", build.DisplayName); SetXmlAttribute(newBuild, "Location", build.Location); var filters = ""; foreach (var filter in build.Filters) { if (!string.IsNullOrEmpty(filters)) { filters += ","; } filters += filter; } var languages = ""; foreach (var language in build.Languages) { if (!string.IsNullOrEmpty(languages)) { languages += ","; } languages += language.ID; } SetXmlAttribute(newBuild, "Filters", filters); SetXmlAttribute(newBuild, "Languages", languages); parentNode?.AppendChild(newBuild); }
public void RemoveBuild(Build build) { var existingBuild = xmlDocument.DocumentElement?.SelectSingleNode("./Builds/Build[@ID='" + build.ID + "']"); existingBuild?.ParentNode?.RemoveChild(existingBuild); }
public void RemoveBuild(Build build) { var existingBuild = xmlDocument.DocumentElement?.SelectSingleNode("./Builds/Build[@ID='" + build.ID + "']"); existingBuild?.ParentNode?.RemoveChild(existingBuild); }