public static void EditLabel(UInt32 address, AddressType type) { CodeLabel existingLabel = LabelManager.GetLabel(address, type); CodeLabel newLabel = new CodeLabel() { Address = address, AddressType = type, Label = existingLabel?.Label, Comment = existingLabel?.Comment }; frmEditLabel frm = new frmEditLabel(newLabel, existingLabel); if (frm.ShowDialog() == DialogResult.OK) { bool empty = string.IsNullOrWhiteSpace(newLabel.Label) && string.IsNullOrWhiteSpace(newLabel.Comment); if (existingLabel != null) { LabelManager.DeleteLabel(existingLabel.Address, existingLabel.AddressType, empty); } if (!empty) { LabelManager.SetLabel(newLabel.Address, newLabel.AddressType, newLabel.Label, newLabel.Comment); } } }
public static void EditLabel(CodeLabel label) { using (frmEditLabel frm = new frmEditLabel(label)) { frm.ShowDialog(); } }