作為MVP三角關系核心的Presenter通過EmployeeSearchPresenter表示
public class EmployeeSearchPresenter
{
public IemployeeSearchView View { get; private set; }
public EmployeeRepository Repository { get; private set; }
public EmployeeSearchPresenter(IEmployeeSearchView view)
{
this
this
this
}
public void Initialize()
{
IEnumerable<Employee> employees = this
this
string[] departments =
new string[] {
this
}
protected void OnDepartmentSelected(object sender
DepartmentSelectedEventArgs args)
{
string department = args
var employees = this
this
}
}
在構造函數中我們注冊了View的DepartmentSelected事件
最後我們來看看作為View的Web頁面如何定義
<html xmlns=
<head>
<title>員工管理</title>
<link rel=
</head>
<body>
<form id=
<div id=
<div class=
選擇查詢部門
<asp:DropDownList ID=
runat=
<asp:Button ID=
OnClick=
</div>
<asp:GridView ID=
AutoGenerateColumns=
[
From:http://tw.wingwit.com/Article/program/net/201311/16124.html