One limitation with using the SmartClientApplication as a basic for your IoC application is that it locks you in to the type of Form that’s going to be displayed when your app starts up. In most cases that’s really not an issue, but sometimes you’d like to decide at runtime what UI to display. You might even want that UI to come from a dynamically loaded DLL.
Well I just added a new capability to the SmartClientApplication. During the startup process, the framework now looks in the Services collection to see if you’ve already registered a Form deriving from the new ShellReplacement base class. If it finds one, that form will be shown instead of the type passed into the SmartClientApplication. The effectively gives you a “default” main shell form, with the ability to dynamically load a different one based on whatever criteria you want. We’re using it to support vertical-specific UIs for the Solution Engine, meaning that if you have the HVAC module installed you’ll get one UI but if you have the Telematics module installed you’ll get another.
The implementation details are as trivial as I could think of making them. First, create your new shell Form like this:
Then register it as the replacement when your Module loads:
That’s all there is to it. You can disable the feature by using the EnableShellReplacement property (defaults to true) of the SmartClientApplication. Get the latest change set (69942 or later) to try out the new feature.