CAB October 2005 Community Technical Preview - release notes

It's out there! check https://practices.gotdotnet.com/projects/cab for the new community technical preview of CAB.

Now, how does CAB CTP2 change from the previous one? this is a frequent question and a fair one. The main goal of CTP2 is making the transition to the release version easier. Thus, our focus was on making the public APIs as stable as possible so changes of applications moving forward are minimized. Of courde changes may occur anyway, but again, we wanted to minimize those.

Interestingly, there are not a lot of public visible changes between CTP2 and CTP1 API. But, if you open the hood and look deep into the implementations of various CAB subsystems that's another story.

Most notably, the dependency injection mechanism has evolved very significantly. We discontinued using ComponentModel and replaced that with something better suited for our needs. It turns out that Enterprise Library was also planing to use this design pattern (DI), so we decided it was best to join forces and use a common model. If you are interested in this, take a look at ObjectBuilder after installing CAB. 

Those of you who have extended CAB CTP1, e.g. by writing your own monitors; will probably experience the biggest changes. If you are using the services provided by CAB without any extensions (like the EventBroker), you will most likely not see any huge difference.

Now talking about the things that will most likely require some changes in your code. One of those is the startup sequence helper classes.

We noticed (both by writing samples using CAB and through feedback sent through our user community and Expert Advisors) that the way applications start (Main) left many knobs and levers to pull. There were lots of opportunities to simplify this. Check out the BankTeller quickstart to see how simple it is now.

For example, in CTP1 the BankTeller main looked like this:

static class Program
{

   static void Main()
{
      Host = new ApplicationHostFactory().CreateHost();

      Host.AddService(typeof(IStatePersistenceService), new IsolatedStorageStatePersistenceService());

      BankShellForm mainForm = Host.DefaultWorkItem.Create<BankShellForm>();

IUIElementManager manager = new UIMenuStripManager(new Uri("uie://mainmenu"), mainForm.MainMenuStrip);
Host.GetService<IUIElementService>().RegisterManager(manager);

LoadMainMenu();

   Host.Initialize();

   Host.DefaultWorkItem.Activate();
Application.EnableVisualStyles();
Application.Run(mainForm);
}

...

Note that there's no particular order enforced.

In CTP2, a similar section looks like this:

public class BankShellApplication : FormShellApplication<WorkItem, BankShellForm>
{
[STAThread]
public static void Main()
{
new BankShellApplication().Run();
}

      protected override void AfterShellCreated()
{
base.AfterShellCreated();

         IUIElementService uiSvc = RootWorkItem.Services.Get<IUIElementService>();
uiSvc.RegisterUIExtensionSite(UIExtensionConstants.MAINMENU, Shell.MainMenuStrip);
uiSvc.RegisterUIExtensionSite(UIExtensionConstants.MAINSTATUS, Shell.mainStatusStrip);
ToolStripMenuItem fileItem = (ToolStripMenuItem)Shell.MainMenuStrip.Items["File"];
uiSvc.RegisterUIExtensionSite(UIExtensionConstants.FILE, fileItem);
uiSvc.RegisterUIExtensionSite(UIExtensionConstants.FILEDROPDOWN, fileItem.DropDownItems);

         UIElementBuilder.LoadFromConfig(uiSvc, RootWorkItem);
}

...

The bases classes provide much cleared hooks to place initialization sections. (Like "AfterShellCreated" in the example above)

Performance has also improved a lot. Documentation is getting much better thanks to our unbeatable technical writer Alex Homer who is doing an amazing job. It was great having you in town these days Alex!

Check out the 3 new documents included in this release. I especially recommend "CAB Walkthrough Guide" which is sort of a mini tutorial for CAB. The three PDFs are located by default in:

   C:\Program Files\Microsoft patterns and practices\Composite UI Application Block October 2005 Community Technology Preview\Help

This is the last drop after te final release. Please let us know what you think!