W
Wayne Pedersen
Need some help - and I may be doing this wrong, so please correct and
suggest!
I'm learning the MVP method, which I seem to have a good grasp of. Now
I am trying something a bit more advanced. I'm declaring an event in a
interface. I'm consuming the interface via another inherited Interface.
I'd like to have my classes respond to this 'one' event...
Based on my below example code, I'd like both Classes Test1 and Test2 to
Respond to EventToShare when it gets raised. How do I do this? I have
things setup as below...
Example Code:
Public Interface IView_Base
Event EventToShare(SomeText as String)
End Interface
Public Interface IView_Test1
Inherits IView_Base
Event AnotherEvent
End Interface
Public Interface IView_Test2
Inherits IView_Base
Event AnotherEvent2
End Interface
Public Class Test1
dim myObj as IView_Test1
Public Sub New(View as IView_Test1)
myObj = View
addhandler myObj.EventToShare, AddressOf Sub1
End Sub
Private Sub Sub1(Text as String)
'Do something with the text
End Sub
End Class
Public Class Test2
dim myObj as IView_Test2
Public Sub New(View as IView_Test2)
myObj = View
addhandler myObj.EventToShare, AddressOf Sub2
End Sub
Private Sub Sub2(Text as String)
'Do something else with the text over here
End Sub
End Class
Thanks for the help!
Wayne P.
suggest!
I'm learning the MVP method, which I seem to have a good grasp of. Now
I am trying something a bit more advanced. I'm declaring an event in a
interface. I'm consuming the interface via another inherited Interface.
I'd like to have my classes respond to this 'one' event...
Based on my below example code, I'd like both Classes Test1 and Test2 to
Respond to EventToShare when it gets raised. How do I do this? I have
things setup as below...
Example Code:
Public Interface IView_Base
Event EventToShare(SomeText as String)
End Interface
Public Interface IView_Test1
Inherits IView_Base
Event AnotherEvent
End Interface
Public Interface IView_Test2
Inherits IView_Base
Event AnotherEvent2
End Interface
Public Class Test1
dim myObj as IView_Test1
Public Sub New(View as IView_Test1)
myObj = View
addhandler myObj.EventToShare, AddressOf Sub1
End Sub
Private Sub Sub1(Text as String)
'Do something with the text
End Sub
End Class
Public Class Test2
dim myObj as IView_Test2
Public Sub New(View as IView_Test2)
myObj = View
addhandler myObj.EventToShare, AddressOf Sub2
End Sub
Private Sub Sub2(Text as String)
'Do something else with the text over here
End Sub
End Class
Thanks for the help!
Wayne P.