This is, unfortunately, how my code looks right now:
Expand|Select|Wrap|Line Numbers
- public abstract class update
- {
- public delegate void button_Callback(object[] pass);
- public static void button(object[] pass)
- {
- Button button = (Button)pass[0];
- string command = (string)pass[1];
- switch (command)
- {
- case "enable":
- button.Enabled = (bool)pass[2];
- break;
- case "text":
- button.Text = (string) pass[2];
- break;
- default:
- break;
- }
- }
- }
Expand|Select|Wrap|Line Numbers
- BeginInvoke(new update.button_Callback(update.button),new object[] { new object[] { btn_startspg, "enable", true}});
I thought of these solutions but none enthuse me that much:
1) one method per method I want to invoke (doesn't really cut down on the coding)
2) create a child of a button and add a delegate for each signature (this would involve changing all my buttons to the child button)
3) append the button class with some delegates so I can directly invoke them (I could be happy with this but I'm not sure this will work)
There must be a brilliant way to do this.
Any suggestions??