Wednesday, 9 May 2007

Composite UI Application Block - Part One

A few months ago I discovered this thing called CAB - Composite UI Application Block.
I was looking for a way to build an application that could load multiple modules and merge them all together seamlessly. I also wanted to have the ability to easily switch data providers at a later date, meaning that I could integrate any number of accounting/product databases into my application.

I read that CAB allows you to seperate your code into independent modules. These modules could interact with each other and the main shell without having to set dependencies. At this point, I realised that CAB was exactly what I was looking for.

CAB has a steep learning curve - it took me a while to work out how the modules fit together.
I've decided to write a series of posts to keep a reference of what I know and to help other developers get started.

What is cab?
Rather than rewrite a definition, I've "borrowed" the one from Cabpedia.com.
(Cabpedia is an excellent resource for learning more about CAB. Many of the questions I initially had were answered there.)

CAB stands for the Composite UI Application Block, and it's a set of .NET 2.0
classes designed to make it easier to build complex Windows Forms
applications. Perhaps the most important way it helps you simplify your
applications is through decoupling the pieces of code that make up a large
application.

CAB also provides support for decoupling the elements
in the user interface. This means you can often make major changes to how
the UI is put together without having to change any of the modules that make up
an application. For example, you might have an Outlook-style user interface
and then decide you want to change it to a web-style interface. No problem.
Just change the UI shell and the modules will load themselves into the new
locations as you've defined it.

When you start a CAB application, you start by creating a UI shell. This is the main form that might include the menu, toolbars, etc.
Next you add one or more Workspaces to the form. These are the locations where the different elements of the UI will appear when the application is running.
Finally, you create one or more modules that contain either elements that will appear in the UI, or Services that will be available for use by other classes.

CAB is perfect for building modular applications. Extending your application is as simple as adding the new module's compiled DLL to the ProfileCatalog.xml file.

Getting Started
It took me a while to get CAB installed and working properly.
Here are the downloads required:

Guidance Automation Extensions - Download
Guidance Automation Toolkit - Download
Composite UI Application Block - Download C# Download VB
Enterprise Library - Download
Smart Client Software Factory - Download

All these toolkits/libraries are used by CAB. Download and install them in the order above. It shouldn't take more than 30 minutes to successfully install everything.

Once these are installed, have a look at the Hands On Labs and this Hello World tutorial from Cabpedia.com.

There are many elements that make up CAB.
In my next post, I will list these elements and explain a bit more about them and what they do.

4 comments:

Unknown said...

30 mins!! It took me ages to install everything...

Unknown said...

30 mins!! It took me ages to install everything..

Anonymous said...

Nice article as for me. It would be great to read something more concerning that theme. The only thing it would also be great to see here is some pictures of any devices.
Kate Trider
Phone jammers

Bryan said...

I'm coming to the party late but I'm designing something using CAB. Do you have any good links or books? It looks like cabpedia is shut down