public void add_handler(object sender, EventArgs e) { try { //if there is a handler method with the same name as the sender it will run it PictureBox temp = (sender as PictureBox); typeof(handlers).GetMethod(circuit.get(temp.Name).type).Invoke(handler, new object[] { temp.Name }); } catch {} }
public void Resistor(string name) { string input = Interaction.InputBox("change resistance", "input", "500"); try { if (input == "") { } else { //get new resistance value temp.get(name).resistance = Convert.ToDouble(input); System.Console.WriteLine("resistance is now " + temp.get(name).resistance); } } catch { MessageBox.Show("invalid input"); } }