Model Viewer Presenter. Take 3

by Marius Gheorghe 17. December 2009 06:40

In the past months i have been implementing in my projects MVP Passive View. You can find the description here. It works pretty good (in Windows Forms and Silverlight projects) and , from my point of view, it's far better than the "other" MVP implementation because the view remains without any logic responsability.

Here's how i implement it. Basically for each view action there is a associated method in the presenter.

public class OrderViewPresenter
{
  private OrderViewDialog dialog = null;

   public OrderViewPresenter(OrderViewDialog d) 

  { 
dialog = d; 
  } 


  public void DisplayData()
 {
//invoke the Order Business Object and load the order
Order o = .......
d.textBoxOrderDate = o.OrderDate;
 }


 public void CreateNewOrder()
 {
//create the new order base on the dialog data
 }

}