Getting Up and Running with the Composite UI Application Block for WPF, Page 3
Following the AddServices call, the execution goes to library code that loads the registered modules, and then proceeds to create the main application form, which is in the sample application's case named ShellForm. Here, workspaces are initialized to contain the SmartParts that are to display the application's main controls: an organization chart and a set of fields to edit database data (see Figure 3).
Figure 3: The sample application running. On the left is a WPF SmartPart displaying an organization chart.
Often, the best way to learn how an application works is to first browse through the source code, and then start running it under the debugger. By stepping the application one code line at a time, you will quickly learn how the application bootstraps, and how control is transferred within the application controls, services, and modules.
In this article, you learned what the Microsoft Composite UI Application Block for WPF (CAB for WPF) is, why it is useful, and how you can get started with one of the sample applications provided in the CAB installation kit.
Although the architecture of CAB is somewhat complex, it is still designed to take complexity away from larger applications. It takes some time to master the inner workings of CAB, but once you are past that phase and actually start using CAB in your own applications, you will notice that you are able to build complicated solutions faster and with less effort.
Once you develop additional applications, it is easier to re-use older code, thanks to the loosely-coupled objects suggested by the block. Thus, the main design goals of CAB—modularity, extensibility, and productivity—are easily met.
If you become a fan of Microsoft's freely-available Patterns & Practices, you also might want to start investigating the other application blocks part of the Smart Client Software Factory (SCSF). For example, the ObjectBuilder and Disconnected Service Agent Application blocks are part of SCSF, and might interest you quite a bit.
But, even though you would only focus on CAB, you have a great set of ready-made classes to support your development efforts. Especially with the recent addition of WPF support, you can start designing applications that use the latest .NET technologies.
Good luck with your adventures in patterns and best practices!
Use these links to download and learn more about the Composite UI Application Block for WPF.
- Download Guidance Automation Extensions—February 2008 Release: http://www.microsoft.com/downloads/details.aspx?FamilyId=DF79C099-4753-4A59-91E3-5020D9714E4E&displaylang=en
- Download Smart Client Software Factory—April 2008: http://www.microsoft.com/downloads/details.aspx?FamilyId=3BE112CC-B2C1-4215-9330-9C8CF9BCC6FA&displaylang=en
- Introduction to the Composite UI Application Block: http://msdn.microsoft.com/en-us/library/cc540685.aspx
- How to Add a WPF-View with a Presenter: http://msdn.microsoft.com/en-us/library/cc540832.aspx
About the Author
Jani Järvinen is a software development trainer and consultant in Finland. He is a Microsoft C# MVP and has written dozens of magazine articles and three books about software development. He is a group leader of a Finnish software development expert group at ITpro.fi. His frequently updated blog can be found at http://www.saunalahti.fi/janij/. You can send him mail by clicking on his name at the top of the article.
Page 3 of 3