Migrating to CAB and Smart Client Software Factory

In my last post, I had the grand idea to create an improved interface for editing snippets in Snip-It Pro. I wanted a full fledged window, with menus and tool bars and tabbed detailed views that can be repositioned across the screen instead of the simple popup that allows you to edit snippet details today.

The more I thought about how this new window would interact with the existing shell, the more I realized I needed a full fledged eventing and command system so that the shell could raise events that the detail window would be able to respond to. I would also need a similar command interception structure and would probably need to make the ui extensible the way I had been working to make the toolbar shell extensible.

In the end, I realized I was just trying to implement my own light weight version of the architecture you would get with CAB and Smart Client Software Factory. So I decided to bite the bullet and just migrate my code base into Smart Client Software Factory.

It turned out, getting this working was not as difficult as I imagined. To use SCSF (once you've installed GAX and SCSF), you need to create a new solution using the guidance package. It generates a number of projects automatically. Once that was set up, I added my existing projects to the main Shell Project and made one simple modification to the ShellApplication class:

ShellApplication : SmartClientApplication<WorkItem, SnipItProShell>

All I needed to do was change the type of form being passed in. Instead of the ShellForm, I changed it to my form. I then was able to leverage all the eventing and command sub systems that I wanted. Even though I made the modification for the eventing subsystem, it also solved my extensibility problems as well, so I migrated the code I wrote to make the shell extensible to Functional and Business Modules inside the SCSF architecture. I also removed the custom Service Locator class I wrote and leveraged the built in Service Locator from CAB.

This was a little more work, but now I think the interfaces and communication between the shell and modules are that much cleaner.

I purchased a ui control suite (DotNetMagic) to give the collapsible tab look and feel you get with Snip-It Pro. This suite also came with a TabbedGroup control that allows you to add tabs to the screen and allow your users to dock and move them the way they want (very similar to Visual Studio). I wrote a CAB Workspace around this control to load the controls and allow the tab layout to be saved correctly.

The more work I do, the more work is left. 

Snip-It Pro 2.0 Update - a Work in Progress

Software Surgery