My solution for the time being:
The Model creates an instance of TCP/IP Service and calls the TCP/IP Service layer.
The different Presenters subscribes to relevant TCP/IP events and updates the View.
To avoid passing of functions (or other problems) I have implemented the TCP/IP Service as a Singleton.
I anyone knows of good examples/articles on how to handle events from a non Microsoft service layer in MVP,
please post a link here.
Elund Christensen, Jul 21, 2010
This is the best answer I ever read!
Oct 24, 2011
Joshua, thanks for your answer :-)
I think my problem is that I have 2 Presenters.
I want both Presenters to subscribe to the TCP/IP events.
The instance of TCP/IP Service layer is created in the Model.
Do I have to pass the functions that should be called in the 2 Presenters to the Model?
Or maybe I should create the TCP/IP Service layer in the base class for all Presenter classes
and then pass it to the Model?
Elund Christensen, Jul 19, 2010
You can probably use a repository pattern/layer to abstract out that service layer calls... and call it within the presenter.
You can use Action<T>/Func<T>/Predicate<T> delegates to subscribe to the events and handle it in the presenter.
just my two cents
Joshua Sim, Jul 19, 2010