private void buttonAdd_Click(object sender, EventArgs e) { // stub up new empty item.... XElement newItem = new XElement("Reagent", new XElement("TypeName", "Reagents."), new XElement("Quantity", "0") ); machine.XML.Element("Reagents").Add(newItem); listBoxReagents.DataSource = machine.GetReagents(); }
private void AddReagent(string reagent, int quantity) { // stub up new empty item.... XElement newItem = new XElement("Reagent", new XElement("TypeName", reagent), new XElement("Quantity", quantity) ); machine.XML.Element("Reagents").Add(newItem); listBoxReagents.DataSource = machine.GetReagents(); listBoxReagents.SelectedIndex = listBoxReagents.Items.Count - 1; }
public ReagentEdit(ThingMachine newMachine) : this() { // populate us... machine = newMachine; listBoxReagents.DataSource = machine.GetReagents(); listBoxReagents.DisplayMember = "Name"; listBoxReagents.ValueMember = "Self"; }
public ReagentEdit(ThingMachine newMachine, int addQuantity, int topUpQuantity) : this() { // populate us... machine = newMachine; listBoxReagents.DataSource = machine.GetReagents(); listBoxReagents.DisplayMember = "Name"; listBoxReagents.ValueMember = "Self"; AddQuantity = addQuantity; TopUpQuantity = topUpQuantity; }