I’ve found some time to grab the outlook bar, fix some bugs and create a quickstart outlook with it.

outlook1

Figure 1 - Outlook created with CAB and Outlook Bar Workspace

outlook2

Figure 2 - Calendar module

I’ve started a project con codeplex to host extensions for CAB and SCSF. If you are interested in participate, fix bugs, add new stuff, let me know.

http://www.codeplex.com/cabextensions

Just released the v1 (zip and msi)

Go get it from http://msdn.microsoft.com/webclientfactory

Lot of stuff shipped:

  • PageFlow Application Block: design the navigation process of a web application using a state machine from Windows Workflow Foundation.
  • Composite Web Application Block: helps you build web clients composed of independent, yet cooperating, modules and increase productivity and reduce overall development time through consolidating architect and developer efforts. From the wiki:
    • Decompose a complex Web site into independent visual and non-visual parts that can be built, assembled, and deployed by independent teams.
    • Minimize cross-team dependencies that allows team specialization for areas such as UI design, business logic implementation (business logic development may occur across multiple teams), and infrastructure code development.
    • Utilize an architecture that promotes reusability across independent teams.
    • Increase the quality of applications by abstracting common services that are available for the independent teams to use.
    • Promote proven practices for security without requiring everyone to be a security expert.
    • Incrementally deploy new capabilities while minimizing downtime.
    • Maximize the coverage of automated tests in the code base.
  • Object Container DataSource: this is a web control similar to ASP.Net ObjectDataSource but instead of relying on a class that provides you with data it will raises events when it needs the data or when the data contained changes (insert/update/delete). This design allows the view (Web page) to delegate the responsibility of performing select operations, update operations, delete operations, and insert operations to the presenter.
  • Web Client Development Automation: I posted about this already.
  • QuickStarts: these are the quickstarts included: View-Presenter (with Application Controller), ObjectContainerDataSource, Modularity, Page Flow, Page Flow with Shopping Cart
  • A Reference Implementation: this is a banking application inspired in a real world example to demonstrate the guidance in action.
  • Documentation, How-Tos, patterns, etc.: available when you install the factory and soon to be published in the codeplex community

It was 6 months of hard work and it was great working again with the patterns & practices team: Blaine (PM), Eugenio (PDM), Mike (Dev Lead), Ed (Architect), Johnny (Dev), Mariano (Dev), Alan (Dev), Bob(Dev), Dragos (Architect), Tim (Tech writer), Juan Carlos (Dev), Prasad (Test) and Terrence (Test).

(This post was going to be posted a few weeks ago so the images are a bit outdated but the content is the same that you will see in latest drops)

I’ve been working on the Guidance Packages for the Web Client Software Factory. If you read this blog you probably know what is this all about. If not, in short we are adding functionality to Visual Studio 2005 to make the developer life easier :)

In the case of the Web Client Software Factory (WCSF from now on), in this first release we are targeting modularity, security and a testable programming model among other things.

In this drop you will see something really close to what we will be shipping.

Let’s deep into what the Guidance Package brings to the table.

First of all we will create a new web application and let’s call it “OrderManager”

wca1

wca2

Before creating the actual solution the recipe asks for a few things:

  • Where do you have the binaries (the new CompositeWeb Application Block and Enterprise Library Jan 2006)? I have compiled them and put them in c:\Lib
  • What’s the .net namespace that you will use for this application?

This is what we get after the solution is created:

wca3

In a nutshell:

  • A Website containing a default page, a default master page a default theme, references to the application blocks and EntLib.
  • A Shell module with a ModuleInitializer. This module will be used for pages that lives in the website root and some services initialization (like the SiteMapBuilderService and the EnterpriseLibraryAuthorizationService)

If you run the website at this point you will get this:

wca4

Adding a module…

We can add our first module by doing a right-click on the Modules solution folder.

wca5

The following feature is part of the “new generation” of guidance packages. Before you commit your module creation you can see what is going to happen to your solution (one project will be created, a folder on the website will be created, etc.)

wca6

The options are:

  • What’s the website project where you want to plug this module?
  • Do you want to have a different name for the folder on the website?
  • Finally we have an “Add test project” option that will create a VSTS test project for you with the Test Fixture for the DefaultViewPresenter

If we run the solution again we will see the new module plugged in the website

wca7

The cool thing about this is the loosely coupled model to add nodes to the sitemap. The OrdersModuleInitializer has a template method to register the sitemap nodes that the module will provide. Here we register the module site map node:

protected virtual void RegisterSiteMapInformation(ISiteMapBuilderService siteMapBuilderService)

        {

            SiteMapNodeInfo moduleNode = new SiteMapNodeInfo("Orders", "~/Orders/Default.aspx", "Orders");

            siteMapBuilderService.AddNode(moduleNode);                     

        }

(A nice addition to this would be a service that reads from the module web.config file and creates the corresponding nodes)

Adding a web page…

We can create pages for our module by right clicking on the “Orders” module folder on the website

wca8

We are leveraging the MVP (Model-View-Presenter) pattern. If you used the Smart Client Software Factory you should be familiar with this, if not you can read more about it here and here.

wca9

The view is separated in three parts:

  • The OrderListPresenter holds the logic for the view and has access to the view via an interface (IOrderList). This increases the testability of your applications. The idea is to have the view do almost nothing. Its responsibility will be to show stuff that the presenter wants and notify the presenter of user events (clicks, selects, etc.).
  • The IOrderList interface is the contract for the Presenter
  • Finally the OrderList.aspx + .cs is the actual implementation of the interface that will show things on the webpage.

If we want to show this view in the navigation control (in this case a TreeView) we would add the following code to the RegisterSiteMapInformation:

        protected virtual void RegisterSiteMapInformation(ISiteMapBuilderService siteMapBuilderService)

        {

            SiteMapNodeInfo moduleNode = new SiteMapNodeInfo("Orders", "~/Orders/Default.aspx", "Orders");

siteMapBuilderService.AddNode(moduleNode);                     

SiteMapNodeInfo orderListNode = new SiteMapNodeInfo("OrderList", "~/Orders/OrderList.aspx", "Order List");

            siteMapBuilderService.AddNode(orderListNode, moduleNode);

        }

Running the site at this instance will show the following:

wca10

Implementing a view and its presenter…

We will implement the basic things to show a list of orders on the web page.

Let’s start from the presenter logic. Note: If we were using TDD we would start from a test that would be called “ShowOrderListOnViewLoaded()”.

    public class OrderListPresenter : Presenter<IOrderList>

    {

        public override void OnViewLoaded()

        {

            // TODO: Implement code that will be executed every time the view loads

            List<Order> orders = new List<Order>();

            orders.Add(new Order("Order 1", 12300, DateTime.Now));

            orders.Add(new Order("Order 2", 200, DateTime.Now));

            orders.Add(new Order("Order 3", 100000, DateTime.Now));

            View.Orders = orders;

        }

We are setting the Orders of the View property. The View property belongs to the base Presenter class and it provides access to the view via its interface (IOrderList).
That means that we need to add the Orders property on the interface

    public interface IOrderList

    {

        IList<Order> Orders { set; }

    }

Finally we will implement it on the OrderList.aspx:

We can use the smart tag on the interface to generate the required interface contract:

wca11

Then we add the GridView to the page

wca12

And finally implement the interface:

    public IList<Order> Orders

    {

        set

        {

            GridView1.DataSource = value;

            GridView1.DataBind();

        }

    }

Running the site again…

wca13

That’s it. We have a Web application that leverages:

  • MVP design pattern
  • The best practices for ASP.Net
  • Exception handling using Enterprise Library 2006
  • Authorization infrastructure also from Enterprise Library
  • Dependency Injection
  • And a lot of other things that you will discover…

Lastly, if you are wondering about “Why use GridView.DataSource and not some DataSourceControl like ObjectDataSource?
We are shipping with the factory a DataSourceControl called ObjectContainerDataSource that will work very well in these scenarios. Mariano has an interesting post.

A picture with Bill Gates

December 4th, 2006

It was the last week during the Strategic Architecture Forum (SAF) here at Redmond.
More than 250 architects from all over the world assisted to this event where Billg gave a 90 minutes Q&A session among other great presentations by the Architecture Strategy Team. Wojtek from patterns & practices presented CAB and the Smart Client Software Factory. Also there was lots of Software as a Service content

withbillg

From left to right: Matias Woloski, Bill Gates, Eric Rudder (behind) and Mariano Szklanny

HelloWorld CAB and SCSF

October 20th, 2006

Some time ago I blogged about CABPedia and the article I wrote “Where to start?“. In this article I try to recommend what’s the best way to start developing with CAB and SCSF. Part of this walkthrough recommend writing the mythical HelloWorld application.

CABPedia, which uses the Mediawiki engine, shows you how many people clicked on a given article. More than 200 people wanted to see the HelloWorld topic, so we created it:

HelloWorld CAB and SCSF

I encourage you to browse the CABPedia. There is a lot of content there.

CAB and SCSF Community

October 9th, 2006

The power of the community is amazing.

Some months ago I was reading a post from Chris Holmes who has a nice idea about creating an outlook bar extension site for CAB applications (the outlook left bar who has the Mail, Calendar, etc). I decided to dedicate some hours to it and came up with the Outlook Bar workspace.

In 5 months almost 1,000 people downloaded it! The other day I came across with a an article in CodeProject written by Arnab Choudhuri

http://www.codeproject.com/useritems/smartclientoutlookbar.asp

It explains how to use the workspace from the scratch… :)

A recurring question on the CAB community is how to perform a voting mechanism to close an application. The FormClosing event allow us to decide wether or not we will let the shell form close. However this is not enough because you might want to decide to close or not based on the state of the views or workitems.

I came up with a simple solution to this using the EventBroker:

Download here

Johnny Halife walkthrough over writing presenters, views and services using TDD. The how-to is based on CAB and SCSF implementation of the MVP pattern, but it provides an insight on how to test-drive the UI logic of your applications.

http://staff.southworks.net/blogs/johnny/archive/2006/09/01/786.aspx

I started writing some content on CABPedia. My first contribution is for newbies on Composite UI Application Block and Smart Client Software Factory

Where to start?

I encourage everyone who *already started* or *is starting* using this software factory to share their experiences in this page.

CABPedia

August 11th, 2006

John Socha, the guy who wrote the great Norton Commander, created this new wiki called CABPedia to share information regarding CAB, Smart Client Software Factory and Mobile Client Software Factory.
This site was necesary for the CAB community and my vision is

“CABPedia should be simple enough to be the starting point for everyone that wants to use [CAB, SCSF, MCSF] and don’t know where to start
but also has the deepness to provide experienced users accurate definitions of every concept around CAB, SCSF, MCSF”

Let’s share now!