Getting Started with the Web Client Software Factory 2010

Are you new to the Web Client Software Factory? After installing the Web Client Software Factory, the best way to get familiar with the Web Client Software Factory is to do the following:

Just Want to Review the Documentation?

If you are in the evaluation phase of the software factory, you can download the documentation before downloading the software factory. Then, when you are ready, you can download the software factory.

Understanding the Basic Steps

Figure 1 illustrates the steps involved in creating the Hello World application.
image1.png
Figure 1
Create Web client solution

These steps are explained in more detail in the following procedure.

To perform the basic steps
  1. Create the Web client solution. To do this, create the project and set some of its properties, such as where the default Web page is located.
  2. Set the startup project, and then compile and run initial solution.
  3. Add a Hello World business module. A business module encapsulates an aspect of your application’s functionality.
  4. Create a page in the Hello World business module. Business modules typically contain related Web pages. The page has a presenter. The presenter contains the logic that implements the behavior of the UI.
  5. Register the page with the site map. This creates a parent and a child node.
  6. Compile and run the solution.The next section describes how to use the Web Client Software Factory recipes to create the Hello World application.

Create Your Hello World Application

This section describes how to use the Web Client Software Factory recipes. To create your first Hello World application, perform the procedures in this section.

Note:  The following procedures require that the Web Client Software Factory guidance package be installed.


image2.png
Figure 2
Create Web client solution

To create the Web client solution
  1. On the File menu, point to New, and then click Project. The New Project dialog box appears. This is shown in Figure 2.
  2. Under Project types, expand Guidance Packages, and then click Web Client Software Factory 2010.
  3. Under Templates, click Web Client Solution (C#, WebSite).
  4. In the Name box, type HelloWorldApplication.
  5. If you do not want to use the default location, enter one in the Location text box, and then click OK.
  6. On the first page of the Create Web Client Solution recipe wizard, confirm (or enter if necessary) the location of the required application block assemblies. This is shown in Figure 3.
  7. In the Root namespace box, type HelloWorld.
  8. Click Finish to unfold the Web Client solution template.
Figure 3: Create Web client solution
image3.png
Figure 3
Create Web client solution recipe wizard

To set the startup project, and then compile and run initial solution
  1. Set HelloWorldApplication as the startup project. To do this, right-click HelloWorldApplication in Solution Explorer, and then click Set as StartUp Project.
  2. Set the Default.aspx page in the root of the HelloWorldApplication site as the start page. To do this, right-click Default.aspx in the root of the Web site, and then click Set as Start Page.
  3. Press F5 to build and run the solution. You should see the default view created by the recipe on the right and a site map node named Home added by the Shell module on the left. Figure 4 shows the initial application running.
image4.png
Figure 4
Hello World Web client application

To add a HelloWorld business module
  • In the Modules solution folder, create a solution folder (not a physical folder) named HelloWorld.
  • Use the guidance package to create a new business module in the HelloWorld solution folder. To do this, right-click the HelloWorld solution folder in Solution Explorer, point to Web Client Factory, and then click Add Business Module (C#).
  • In the Add New Project dialog box, type HelloWorld in the Name box. This is shown in Figure 5.
image5.png
Figure 5
Add new project dialog box
  • In the Location box, click Browse to select %SolutionPath%\HelloWorldApplication\Modules\HelloWorld (create the HelloWorld folder if necessary).
  • Click OK to create the project and launch the recipe wizard.
  • The Add Business Module recipe wizard appears. Select the Click Finish*. This is shown in Figure 6.

image6.png
Figure 6
Add Business Module recipe wizard

Note: For more information about how to create a module in your solution, see “How To: Create a Business Module” in the Web Client Software Factory documentation.


To create a page in the HelloWorld module
  • Create a new page named HelloWorldPage. To do this, right-click the HelloWorld folder inside HelloWorldApplication site, point to Web Client Factory, and then click Add Page (with presenter) (C#). The recipe wizard appears. This is shown in Figure 7.
image7.png
Figure 7
Add Page (with presenter) recipe wizard
  • In the Page name box, type HelloWorldPage, and then click Finish. The Add Page (with presenter) recipe will add the IHelloWorldPageView interface and the HelloWorldPagePresenter class into Views folder inside HelloWorld project and the HelloWorldPage page into HelloWorld folder inside the HelloWorldApplication site.
Note: For more information about how to create a page in your module, see “How to: Add a Page with a Presenter” in the Web Client Software Factory documentation.
  • Open the HelloWorldPage.aspx file, and then change the message “HelloWorldPage” to “Hello World!” The source code of the page must look like the following.
Code: ASP.NET
<%@ Page Language="C#" AutoEventWireup="true"
         CodeFile="HelloWorldPage.aspx.cs"
         Inherits="HelloWorld.HelloWorld.Views.HelloWorldPage"
         Title="HelloWorldPage"
         MasterPageFile="~/Shared/DefaultMaster.master" %>

<asp:Content ID="content"
             ContentPlaceHolderID="DefaultContent"
             Runat="Server">
    <h1>Hello World!</h1>
</asp:Content>


To register the page with the site map
  1. In Solution Explorer, double-click in the HelloWorldModuleInitializer.cs file located in the root of HelloWorld project inside the HelloWorld solution folder.
  2. In the RegisterSiteMapInformation method, add the site map node corresponding to the HelloWorldPage page, as shown in the following code.
Code: C#
protected virtual void RegisterSiteMapInformation(ISiteMapBuilderService siteMapBuilderService)
{
    SiteMapNodeInfo moduleNode = new SiteMapNodeInfo("HelloWorld", "~/HelloWorld/Default.aspx", "HelloWorld");
    siteMapBuilderService.AddNode(moduleNode);

    SiteMapNodeInfo moduleNode1 = new SiteMapNodeInfo("HelloWorldPage", "~/HelloWorld/HelloWorldPage.aspx", "Hello World Page");
    siteMapBuilderService.AddNode(moduleNode1, moduleNode);
}


To compile and run the application
  • Press F5 to build and run the solution. You should see two site map nodes added by the HelloWorld module (the parent and the child). This is shown in Figure 8.
image8.png
Figure 8
Site map nodes added by the Hello World module
  • Click in the Hello World Page child node. You should see the page added by the Add Page (with presenter) recipe. Figure 9 shows the HelloWorldPage.aspx page.
image9.png
Figure 9
Hello World page

After you create your Hello World application, you can use the Web Client Software Factory How-to topics in the documentation to extend your application. The Hello World application can help you to do the following:
  • Create a Web client solution.
  • Enable a Web site to Use ASP.NET AJAX extensions.
  • Create a business module.
  • Create a foundational module.
  • Add a page with a presenter.
  • Add a master page with a presenter.
  • Add a user control with a presenter.
  • Implement the Model-View-Presenter pattern.
  • Unit test a presenter.
  • Register and use services.
  • Add module pages to the site map.
  • Use a module controller from a presenter.
  • Use session state with unit testing.
  • Map types for dependency injection.
  • Authorize Web pages.
  • Use the ObjectContainerDataSource control.
  • Use the ServerSideValidationExtender control.
  • Use the RealTimeSearchMonitor extender.
  • Use the ContextSensitiveAutoCompleteExtender control.
For information about how to perform these activities, see the "Development Activities" topic in the documentation.

Building and running the Reference Implementations and QuickStarts

This section assumes the Web Client Software Factory Source Code has been installed.
Some solutions require the Ajax Control Toolkit assembly that targets the .NET Framework 3.5 (downloaded separately). These solutions were tested on Version 11119 of the toolkit. The solutions that require Ajax Control Toolkit are:
  • Order Management Reference Implementation
  • Validation QuickStart
  • AutoComplete QuickStart

Note: In order to build these solutions, first copy the Ajax Control Toolkit assembly to the *Lib\AjaxControlToolkit3.5* folder.
  1. Open the desired Reference Implementation or QuickStart solution file.
  2. Press F5 to build and run the application.

More Information

For access to other documentation and resources, or to provide feedback, see the Web Client Software Factory Web site. For more general information about the goals of this and other patterns & practices deliverables, see the Microsoft patterns & practices Development Center.

Last edited May 13, 2010 at 1:01 AM by hanz, version 18

Comments

No comments yet.