We have a pretty large application built using C # / WPF / Prism. The application has several static modules and an unknown number of dynamically loaded modules.
My area of influence is related to static modules and shell.
I am invited to implement a function that will restart the shell, but only after requesting all the modules currently open, whether restarting is allowed. If at least one module says that it is not allowed (example: still unsaved changes), the restart is delayed.
Now the shell and modules communicate through EventAggregator. This means that I can post the event and then see if any of the subscribers are denied or restart is allowed.
This works great for all modules that I could change. However, I cannot change dynamic modules (different commands, different control sources).
One of the requirements was that if any module does not support this new function, it should be considered as a refusal to restart.
The obvious problem is how to find out that someone hasn't signed up for the event?
Although all viewmodels implement our interface IViewModel, I see no way to find out how many views currently exist (so I could at least see if all this was allowed, or if some answers are simply missing).
I could find out how many modules it supports, but even then nothing is said about how many view models are currently open / exist / used by the views.
, ?