Windows Develop Bookmark and Share   
 index > Windows Forms General > Register Eventhander with MethodInfo
 

Register Eventhander with MethodInfo

hallo,
i want to implement some dynamic ObserverEvent Pattern.
For this reason i have some Methods in a OForm attributet with a Custom "ObserverAttribute".
During loading of this OForm i reflect over the methods which are attributet with this "ObserverAttribute" and rember the "MehtodInfo" of the attributet Method.

I have an "EventManager" (EM). In this EM i want to initiate an EventHander dynamically... like

-----------------------------------------------------------------------
public void RegisterObserver(MethodInfo mi, EventMode eventMode)
{
switch (eventMode)
{
case EventMode.FilterChanged:
FilterChanged += new FilterChangedEventHandler("Here i want to get the Method from the MethodInfo");
break;
----------------------------------------------------------------------

could this work, and what can i do.
Thanks a lot
Arnold

aspatz  Sunday, February 25, 2007 7:32 PM
i found an approach to handle this problem.
http://www.codeproject.com/csharp/FastMethodInvoker.asp

Thanks for your thought about this problem.

Arnold
aspatz  Monday, February 26, 2007 12:42 PM
i found an approach to handle this problem.
http://www.codeproject.com/csharp/FastMethodInvoker.asp

Thanks for your thought about this problem.

Arnold
aspatz  Monday, February 26, 2007 12:42 PM

You can use google to search for other answers

Custom Search

More Threads

• Detect if child controls are visible or not
• Is TreeNode threadsafe?
• chiled forms and parent form
• Is there some serial port selection comtrol?
• Using System.Drawing while creating a .dll file
• Button Click does not call after validating event.
• Rich text box margin problem
• Display data in 2 forms
• Drag and Drop Label containing text into another panel
• Listbox flicker when combo box drops down