should i using System.Windows.Forms in the Presenter class base on MVP
In the article Build your own CAB Part #8 - Assigning Responsibilities in a Model View Presenter Architecture, the author said:
but don't allow any reference to any Type in the System.Windows.Forms namespace from the Presenter class.
I have some questions for your above words. Suppose I want to build a tree in the UI, and for each tree node I need attach some info, so the IView should expose a interface AddTreeNode to Presenter, so the Presenter can call this interface to add a treenode on the tree, right? I think the parameters for AddTreeNode interface should be like (Tr开发者_Go百科eeNode newNode, TreeNode Parent), then in the Presenter class it should add System.Windows.Forms as reference, how should I handle this case?
the IView should expose a interface AddTreeNode to Presenter
Not really. I think that IView should expose events which Presenter can call to pass model data there. View layer implements those events and can take the data and call any methods of controls (AddTreeNode and so on).
精彩评论