mardi 31 mai 2016

How to go from MethodInfo[] to Action

I am mapping an xbox controller and want a way for the user to change what key does what in the program. I use a dictionary with the key as a ControllerEventArgs ( custom event args) and value is Action, which is the function that will be invoked when the button is pressed.

Everything is in place except one part: We are able to open a combo box with all they buttons (A Pressed, A Released, B, X, Y, etc) and using reflection and attributes I display all the possible methods (actions) the button can make. So the user goes ahead and chooses it - But now I have the method name in the MethodInfo[] and I need it as an Action to pass to/modify my dictionary. Any way to do this? I am new to reflection and attributes.





Aucun commentaire:

Enregistrer un commentaire