The sample application consists of a Model View - View Model (MVVM) style Silverlight 4 bike wizard and associated unit tests. It shows you how to use some Caliburn Micro (CM) features such as:

- convention based mapping between view- and viewmodel properties and actions. The sample relies on CM's default conventions whenever possible, and uses explicit bindings only when necessary.  
- the use of the EventAggregator class for implementing the publish / subscribe pattern. In the sample application, when a bike order is complete a BikeOrderEvent message is published by the BikeWizardViewModel. The LogViewModel subscribes to these messages. LogEvent messages (and their derivatives) are published by the Caliburn Micro LogManager (through the implementation of a custom ILog class). The LogViewModel also listens for those messages.  
- the use of the WindowManager class. The WindowManager class is used to show the WizardViewModel after you click the "Start Bike Order Wizard" button. 
- coroutines usage to simply asynchronous actions that require sequential execution. Take a look at the unit tests. 

The sample uses MEF to compose objects and set up their dependencies. An important advantage of using the MVVM pattern is that is becomes much easier to do unit testing. The sample application shows how you can unit tests the ViewModels without relying on the actual views that interact with the user (see: ViewModelTests.cs). It also shows how you can test the View-ViewModel bindings, which is another important aspect (see: BindingTests.cs).  

The UI and code are based on the code accompanying the price winning "Code Project" article "Creating an Internationalized Wizard in WPF" from dec. 2008. It's a great article and you can read it here:

Getting started

After you download the code set the startup project to "BikeWizard.Web" and the start page to "Default.aspx" (if that's not already the case). This will run the silverlight application. If you want to run the unit tests instead, just change the start page to "Caliburn.Micro.BikeWizard.TestsTestPage.aspx".

The sample uses some fake in memory data, so you don't have to create a database.

Have fun with it!

Last edited Nov 30, 2010 at 2:00 PM by jbijlsma, version 9


No comments yet.