How to control the order of module initialization in Prism

Posted by Robert Taylor on Stack Overflow See other posts from Stack Overflow or by Robert Taylor
Published on 2009-08-18T21:32:23Z Indexed on 2010/06/16 10:22 UTC
Read the original article Hit count: 301

Filed under:
|
|

I'm using Prism V2 with a DirectoryModuleCatalog and I need the modules to be initialized in a certain order. The desired order is specified with an attribute on each IModule implementation.

This is so that as each module is initialized, they add their View into a TabControl region and the order of the tabs needs to be deterministic and controlled by the module author.

The order does not imply a dependency, but rather just an order that they should be initialized in. In other words: modules A, B, and C may have priorities of 1, 2, and 3 respectively. B does not have a dependency on A - it just needs to get loaded into the TabControl region after A. So that we have a deterministic and controllable order of the tabs. Also, B might not exist at runtime; so they would load as A, C because the priority should determine the order (1, 3). If i used the ModuleDependency, then module "C" will not be able to load w/o all of it's dependencies.

I can manage the logic of how to sort the modules, but i can't figure out where to put said logic.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about wpf