3

I am designing a Winforms MDI application following MVP pattern, and I'm stuck on some problems related to communication between different part of my application.

Here a simple picture of this application: 1 -On the left a treeview 2- In the middle a drawing component 3- on the right, a "property" form. These 3 parts are managed with a MVP triad ( well ,not really , Model is common to all triads)

When I click on a node on the treeview, I want to see a drawing of the corresponding selected object in the drawing component ,and I want to see some properties corresponding to this selected object in the property form.

My basic question are : a) Where to store "Selected object " information ? b) How to warn Drawing component and property form that "Selected object " has changed ?

I started to imagine some solutions but I am quite unhappy.

I don't buy putting "Selected object " in the Model and perform observer synchronization. "Selected object " does not belong to the Model

SO I imagine, I would store this information in a presenter If I put "Selected object " in Treeview presenter, it seems to me that both Presenter for drawing component and Presenter for Property form will have to hold a reference on treeview presenter, to retrieve this information.

It creates some coupling between presenters , and I don't like also.

So I am looking for other ideas, and or comments. thanks for your time.

flamandier
  • 502
  • 4
  • 6

1 Answers1

0

First of all, sorry for a late response :) had lots of stuff to finish :D

I don't know how exactly your code is built but may be you could use Retlang. Then you could easily pass list of IDs in the message and handle this message wherever you like.

Also it would be quite interesting for me to hear how you managed to solve your problem a year ago.