This project is read-only.
Let's add a Web UI to your clock solution.

1 - Create the ASP.NET MVP Web Application Project


2 - Reference the existing Presenter Assembly

Open the Web.config file, and modify the Claymore config section like this :

      <Add assemblyName="Clock.Presenters"/>

Note : At runtime Claymore will dynamically invoke the Presenters implementation; So that Clock.Presenters.dll must be placed in the output directory (bin/debug or bin ) of the project.

3 - Design the ASP.NET UI

Open Default.aspx file and follow this example :

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Clock.WebViews.Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="" >
<head runat="server">
    <form id="form1" runat="server">
        <asp:Button ID="BtnTime" runat="server" Text="What time is it?"/>
        <asp:Label ID="LblWord" runat="server"></asp:Label>

4 - Implement the View

Open Default.aspx.cs and add the following code :

using System;
using System.Web.UI;
// include your IView namespace(s) here.
using Clock.IViews;

namespace Clock.WebViews
    /// <summary>
    /// Add your IViews Implementations here.
    /// </summary>
    public partial class Default : Page, IClockView
        public event GetTimeEventHandler GetTime;

        protected override void OnLoad(EventArgs e)

            BtnTime.Click += onGetTimeClicked;

        private void onGetTimeClicked(object sender, EventArgs e)
            if (GetTime != null)
                LblWord.Text = GetTime(this, EventArgs.Empty);

5 - Launch it :)


Last edited Feb 17, 2010 at 10:22 PM by Fab_Michellonet, version 3


No comments yet.