Caliburn.Micro

TwitterFacebook
Get flash to fully experience Pearltrees
http://www.csharpit.com/?p=11

Composable Application – Using MEF and Caliburn Micro - C# It !

Introduction Caliburn Micro is a micro-framework for WPF, Silverlight and WP7 giving us great features for developing all sort of MVVM based application. Either you are developing a simple app or a complex one with composable module parts like Outlook, you will find CM to be fastest way to develop it, while keeping a true MVVM architecture. Modularity and Dependency Injection When we develop an application which consist of multiple modules, we need to keep each module as an Independent block.
http://devlicio.us/blogs/rob_eisenberg/archive/2010/07/06/caliburn-micro-soup-to-nuts-pt-1-configuration-actions-and-conventions.aspx

Caliburn.Micro Soup to Nuts Pt. 1 – Configuration, Actions and Conventions

In this tutorial we will learn a few of the basics of Caliburn.Micro . Let’s start by getting the framework. Head on over to http://caliburnmicro.codeplex.com/SourceControl/list/changesets Either use Mercurial to clone the repo or click on the link for the latest change set, then click on the download link. I recommend that you go ahead and get setup with TortoiseHG for Mercurial.
In the last part we discussed the most basic configuration for Caliburn.Micro and demonstrated a couple of simple features related to Actions and Conventions. In this part, I would like to explore the Bootstrapper class a little more. Let’s begin by configuring our application to use an IoC container.

Caliburn.Micro Soup to Nuts Pt. 2 – Customizing The Bootstrapper

http://devlicio.us/blogs/rob_eisenberg/archive/2010/07/08/caliburn-micro-soup-to-nuts-pt-2-customizing-the-bootstrapper.aspx
http://devlicio.us/blogs/rob_eisenberg/archive/2010/07/17/caliburn-micro-soup-to-nuts-pt-3-all-about-actions.aspx We briefly introduced actions in Pt. 1 , but there is so much more to know. To begin our investigation, we’ll take our simple “Hello” example and see what it looks like when we explicitly create the actions rather than use conventions. Here’s the Xaml: < UserControl x:Class = "Caliburn.Micro.Hello.ShellView" xmlns = "http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x = "http://schemas.microsoft.com/winfx/2006/xaml" xmlns:i = "clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:cal = "http://www.caliburnproject.org" > < StackPanel > < TextBox x:Name = "Name" /> < Button Content = "Click Me" > < i:Interaction.Triggers > < i:EventTrigger EventName = "Click" > < cal:ActionMessage MethodName = "SayHello" /> </ i:EventTrigger > </ i:Interaction.Triggers > </ Button > </ StackPanel > </ UserControl >

Caliburn.Micro Soup to Nuts Pt. 3 – All About Actions

Caliburn.Micro Soup to Nuts Pt. 4 – Working with Windows Phone 7

Hopefully, previous articles have you up to speed on what Caliburn.Micro is , its basic configuration , and how to take advantage of a few of its features . In this part, I want to talk about some WP7 specifics issues. It’s unfortunate that I have to call out WP7, but your going to find that while you may be an experienced WPF or Silverlight developer, that doesn’t make WP7 development a snap. Microsoft still has a long ways to go in making “three screens and the cloud” a reality. The new features in Caliburn.Micro are specifically designed to address some of the shortcomings in WP7, particularly around Navigation (with ViewModels and Screen Activation), Tombstoning and Launchers/Choosers. http://devlicio.us/blogs/rob_eisenberg/archive/2010/08/07/caliburn-micro-soup-to-nuts-pt-4-working-with-windows-phone-7.aspx

Caliburn.Micro Soup to Nuts Pt. 5 – IResult and Coroutines

Before our WP7 detour , we were deep in the thick of Actions . I mentioned that there was one more compelling feature of the Actions concept called Coroutines. If you haven’t heard that term before, here’s what wikipedia * has to say: In computer science , coroutines are program components that generalize subroutines to allow multiple entry points for suspending and resuming execution at certain locations. Coroutines are well-suited for implementing more familiar program components such as cooperative tasks , iterators , infinite lists and pipes . Here’s one way you can thing about it: Imagine being able to execute a method, then pause it’s execution on some statement, go do something else, then come back and resume execution where you left off. http://devlicio.us/blogs/rob_eisenberg/archive/2010/08/21/caliburn-micro-soup-to-nuts-part-5-iresult-and-coroutines.aspx
http://devlicio.us/blogs/rob_eisenberg/archive/2010/10/08/caliburn-micro-soup-to-nuts-part-6a-screens-conductors-and-composition.aspx

Caliburn.Micro Soup to Nuts Part 6a – Screens, Conductors and Composition

Actions, Coroutines and Conventions tend to draw the most attention to Caliburn.Micro, but the Screens and Conductors piece is probably most important to understand if you want your UI to be engineered well. It’s particularly important if you want to leverage composition. The terms Screen, Screen Conductor and Screen Collection have more recently been codified by Jeremy Miller during his work on the book "Presentation Patterns" for Addison Wesley . While these patterns are primarily used in CM by inheriting ViewModels from particular base classes, its important to think of them as roles rather than as View-Models. In fact, depending on your architecture, a Screen could a be a UserControl, Presenter or ViewModel. That’s getting a little ahead of ourselves though.
Previously, we discussed the theory and basic APIs for Screens and Conductors in Caliburn.Micro. Now I would like to walk through the first of several samples. This particular sample demonstrates how to set up a simple navigation-style shell using Conductor<T> and two “Page” view models. http://devlicio.us/blogs/rob_eisenberg/archive/2010/10/12/caliburn-micro-soup-to-nuts-part-6b-simple-navigation-with-conductors.aspx

Caliburn.Micro Soup to Nuts Part 6b – Simple Navigation with Conductors

Caliburn.Micro Soup to Nuts Part 6c – Simple MDI with Screen Collections

Let’s look at another example: this time a simple MDI shell that uses “Screen Collections.” As you can see, once again, I have kept things pretty small and simple: Here’s a screenshot of the application when it’s running: Here we have a simple WPF application with a series of tabs. Clicking the “Open Tab” button does the obvious. http://devlicio.us/blogs/rob_eisenberg/archive/2010/10/19/caliburn-micro-soup-to-nuts-part-6c-simple-mdi-with-screen-collections.aspx
http://devlicio.us/blogs/rob_eisenberg/archive/2010/11/18/caliburn-micro-soup-to-nuts-part-6d-a-billy-hollis-hybrid-shell.aspx

Caliburn.Micro Soup to Nuts Part 6d – A “Billy Hollis” Hybrid Shell

Up until now I’ve been focusing on fairly simple usage of Screens and Conductors. In this article, I want to show something a bit more sophisticated. This sample is based loosely on the ideas demonstrated by Billy Hollis in this well-known DNR TV episode . Rather than take the time to explain what the UI does, have a look at this short video for a brief visual explanation (apologies for the audio level). Ok, now that you’ve seen what it does, let’s look at how it’s put together.

Caliburn.Micro Soup to Nuts Part 7 - All About Conventions

One of the main features of Caliburn.Micro is manifest in its ability to remove the need for boiler plate code by acting on a series of conventions. Some people love conventions and some hate them. That’s why CM’s conventions are fully customizable and can even be turned off completely if not desired. If you are going to use conventions, and since they are ON by default, it’s good to know what those conventions are and how they work. That’s the subject of this article.
In Caliburn.Micro we have a series of supporting services for building presentation tiers. Among them is the EventAggregator, a service which supports in-process publish/subscribe. There are various implementations of this pattern available in other frameworks, but I think you’ll find that Caliburn.Micro’s implementation sports the cleanest API and the richest set of features. Let’s start by having a look at the IEventAggregator interface: public interface IEventAggregator { void Subscribe( object instance); void Unsubscribe( object instance); void Publish( object message, Action<System.Action> marshal = null ); } public interface IEventAggregator { void Subscribe(object instance); void Unsubscribe(object instance); void Publish(object message, Action<System.Action> marshal = null); }

Caliburn.Micro Soup to Nuts Part 8–The EventAggregator

Caliburn.Micro Soup to Nuts Part 9–New WP7 Features

In version 1.0 we had pretty good support for building apps for WP7, but in v1.1 we’ve taken things up a notch. Let’s look at the same HelloWP7 sample that we did previously , but see how it’s been updated to take advantage of our improved tombstoning, launcher/chooser support and strongly typed navigation. You’ll also notice that the code is cleaner overall. Bootstrapper Here’s the cleaned up boostrapper in v1.1.