private void cmdAddPower_Click(object sender, EventArgs e) { frmSelectPower frmPickPower = new frmSelectPower(ObjCharacter); frmPickPower.ShowDialog(this); // Make sure the dialogue window was not canceled. if (frmPickPower.DialogResult == DialogResult.Cancel) { return; } Power objPower = new Power(ObjCharacter); // Open the Cyberware XML file and locate the selected piece. XmlDocument objXmlDocument = XmlManager.Load("powers.xml"); XmlNode objXmlPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[name = \"" + frmPickPower.SelectedPower + "\"]"); if (objPower.Create(objXmlPower)) { ObjCharacter.Powers.Add(objPower); MissingDatabindingsWorkaround(); if (frmPickPower.AddAgain) { cmdAddPower_Click(sender, e); } } }
private void cmdAddPower_Click(object sender, EventArgs e) { // Open the Cyberware XML file and locate the selected piece. XmlDocument objXmlDocument = XmlManager.Load("powers.xml"); bool blnAddAgain; do { frmSelectPower frmPickPower = new frmSelectPower(_objCharacter); frmPickPower.ShowDialog(this); // Make sure the dialogue window was not canceled. if (frmPickPower.DialogResult == DialogResult.Cancel) { frmPickPower.Dispose(); break; } blnAddAgain = frmPickPower.AddAgain; Power objPower = new Power(_objCharacter); XmlNode objXmlPower = objXmlDocument.SelectSingleNode("/chummer/powers/power[id = \"" + frmPickPower.SelectedPower + "\"]"); frmPickPower.Dispose(); if (objPower.Create(objXmlPower)) { _objCharacter.Powers.Add(objPower); MakeDirtyWithCharacterUpdate?.Invoke(null, null); } }while (blnAddAgain); }