Changeset 110

User picture

Author: marisic.net

(2009/02/16 04:40) Almost 3 years ago


  

Affected files

Updated StructuredWeb/StructuredWeb/Common/Common.csproj Download diff

109110
57
  <ItemGroup>
57
  <ItemGroup>
58
    <Compile Include="BusinessConversation.cs" />
58
    <Compile Include="BusinessConversation.cs" />
59
    <Compile Include="ConversationMode.cs" />
59
    <Compile Include="ConversationMode.cs" />
60
    <Compile Include="View\IView.cs" />
60
    <Compile Include="View\Presenter.cs" />
61
    <Compile Include="View\Presenter.cs" />
61
    <Compile Include="View\IPresenter.cs" />
62
    <Compile Include="View\IPresenter.cs" />
62
    <Compile Include="PresenterScanner.cs" />
63
    <Compile Include="PresenterScanner.cs" />

Added StructuredWeb/StructuredWeb/Common/View/IView.cs

Show contents

Updated StructuredWeb/StructuredWeb/Common/View/Presenter.cs Download diff

109110
1
namespace StructuredWeb.Common.View
1
namespace StructuredWeb.Common.View
2
{
2
{
3
    public class Presenter<T> : IPresenter<T>
3
public abstract class Presenter<TView> where TView : IView
4
{
5
    public TView View { get; set; }
6
7
    public virtual void OnViewInitialized()
4
    {
8
    {
5
        #region IPresenter<T> Members
9
    }
6
10
7
        public T View { get; set; }
11
    public virtual void OnViewLoaded()
8
12
    {
9
        public virtual void OnViewInitialized()
10
        {
11
        }
12
13
        public virtual void OnViewLoaded()
14
        {
15
        }
16
17
        #endregion
18
    }
13
    }
14
}
19
}
15
}

Updated StructuredWeb/StructuredWeb/Modules/EmployeeManagement/View/EmployeePresenter.cs Download diff

109110
7
7
8
namespace StructuredWeb.Modules.EmployeeManagement.View
8
namespace StructuredWeb.Modules.EmployeeManagement.View
9
{
9
{
10
    public class EmployeePresenter : Presenter<IEmployeeView>
10
public class EmployeePresenter : Presenter<IEmployeeView>
11
{
12
    private readonly IEmployeeController _controller;
13
14
    public EmployeePresenter(IEmployeeController controller)
11
    {
15
    {
12
        private readonly IEmployeeController _controller;
16
        _controller = controller;
17
    }
13
18
19
    [BusinessConversation]
20
    public override void OnViewInitialized()
21
    {
22
        View.Employees = _controller.GetEmployees();
23
    }
14
24
15
        public EmployeePresenter(IEmployeeController controller)
25
    public override void OnViewLoaded()
16
        {
26
    {
17
            _controller = controller;
27
        View.EmployeesListDatasource = View.Employees;
18
        }
19
20
        [BusinessConversation]
21
        public override void OnViewInitialized()
22
        {
23
            View.Employees = _controller.GetEmployees();
24
        }
25
26
        public override void OnViewLoaded()
27
        {
28
            View.EmployeesListDatasource = View.Employees;
29
        }
30
    }
28
    }
29
}
31
}
30
}

Updated StructuredWeb/StructuredWeb/Modules/EmployeeManagement/View/IEmployeeView.cs Download diff

109110
1
#region Using Statements
1
#region Using Statements
2
2
3
using System.Collections.Generic;
3
using System.Collections.Generic;
4
using StructuredWeb.Common.View;
4
using StructuredWeb.Domain.Business;
5
using StructuredWeb.Domain.Business;
5
6
6
#endregion
7
#endregion
7
8
8
namespace StructuredWeb.Modules.EmployeeManagement.View
9
namespace StructuredWeb.Modules.EmployeeManagement.View
9
{
10
{
10
    public interface IEmployeeView
11
    public interface IEmployeeView: IView
11
    {
12
    {
12
        IList<Employee> Employees { get; set; }
13
        IList<Employee> Employees { get; set; }
13
        IList<Employee> EmployeesListDatasource { set; }
14
        IList<Employee> EmployeesListDatasource { set; }

Updated StructuredWeb/StructuredWeb/StructuredWeb/ViewBasePage.cs Download diff

109110
10
10
11
namespace StructuredWeb
11
namespace StructuredWeb
12
{
12
{
13
    public abstract class ViewBasePage<TPresenter, TView> : Page where TPresenter : Presenter<TView>
13
    public abstract class ViewBasePage<TPresenter, TView> : Page where TPresenter : Presenter<TView> where TView : IView
14
    {
14
    {
15
        protected TPresenter _presenter;
15
        protected TPresenter _presenter;
16
16