I'm working on an application to allow control of independent hardware devices. Some basic requirements are:
1. An arbitrary number of devices must be supported
2. Multiple instances of a given device must be supported
The approach I've taken is to create one module per type of hardware device. Requirement 1 is thus supported since I can create as many modules as I need.
To support requirement 2, I've been intending to create as many instances of a module as needed. For example, if I need to control two Acme ABC123 devices, I would have one module named AcmeABC123Module and would instantiate it twice in App.config as follows:
However, I've recently read in the archives that modules generally get loaded once and that multiple view instances get created. However, that doesn't work in my case since, for example, each device is on a different comm link. In other words, I have business
data specific to each device stored at the module level.
Since, I'm new to Prism, I'd like to ask: Does my intended approach fit within the intended use of Prism? The guidance doesn't seem to address this issue, so I'm looking to a broader knowledge base. If my intended approach does not fit within the intended
use of Prism, I'd like to solicit suggestions on how a problem such as this should be solved.
If loading a module multiple times is indeed fine (and, based on experiments, it does seem to work), how can a module instance know which instance it is? For example, in the XAML above, I assigned a unique moduleName to each module instance. However, I can't
find a way to get at this within the module's code (I posted about this yesterday). Is there a way for a module instance to know its identity when multiple instances of that module type exist?
Thanks for any help!