Building an OS with Silverlight+PRISM
So after a long time coming, I have finally fallen for PRISM. I am working with a customer to build a highly extensible presentation layer platform that will accomplish the following goals:
Speed Time-to-Market Lower UI Development Costs
We are achieving these goals by of course leveraging Silverlight as our development platform but more importantly leveraging PRISM and Unity to build the underlying extensible architecture.
Our solution consists of a Desktop Application that contains the main shell and boot strapper. Then each “application” is implemented as a module that can be loaded into this shell. We define a couple standard regions within the desktop to provide for standardized branding and place-holders for application specific menus and commands such as full-screen, configure, and close.
We then built a couple behaviors that handle execution of these application modules. The first is the single instance behavior which will check to see if the application module is currently running and will switch the window manager to that application.
Next we built a multi-instance behavior that will just execute the application no questions asked. In doing this, the complexity increases quite a bit as we need to track application and “session” (I’m using this term loosely). There is another wrench that gets thrown into the work here as well. Since our application modules have their own shell and their own regions when we load multiple instances of them we need to make sure that we use scoped region managers otherwise PRISM will throw the following exception: “Region with the given name is already registered”. This article on MSDN provides a very concise (and accurate) guide on how to leverage scoped region managers.
With this approach we will eventually be able to deploy applications to the “desktop” through an administrative application module that allows users to upload a XAP file, icon, application title and description.