ama_trig
Full Member level 2
- Joined
- Oct 9, 2009
- Messages
- 123
- Helped
- 20
- Reputation
- 40
- Reaction score
- 13
- Trophy points
- 1,298
- Location
- Where my hard drive lives!
- Activity points
- 2,100
Code:
Class A
{
ButtonClick()
{
//SomeVariable
//SomeCode
***According to SomeVariable, set callback of Class B's Method_1 to
*** UpdataA Method or UpdateB Method or anything else defined here
***(not written in Method_1 code block, so it can be changed from here)
Something like this :
Call ClassB.Method2(timer_interval,Method_UpdateA_ResultOfMethod1)
or
Call ClassB.Method2(timer_interval,Method_UpdateA_ResultOfMethod2)
}
Method_UpdateA_ResultOfMethod1(string INPUT)
{
//some code
//Display Input
}
Method_UpdateB_ResultOfMethod1(string INPUT)
{
//some code
//Display Input
}
}
Class B
{
Method_1()
{
//some code
How to callback to Class A method (predefined by method 2) and pass an argument?
}
Method_2(?)
{
//Install Timer On method 1 that triggers every second
How to set a callback to One of methods of Class A ?
}
}
So far what I've read is that an event and delegate must be used, But I couldn't make it work, I think this is because I don't understand anonymous delegates, event, ... well enough.