Mar 21, 2013 at 1:38 AM
Edited Mar 21, 2013 at 1:39 AM
Thanks for getting back to me. I 'm trying to use the ServiceLocator but am running into problems. After doing a lot of reading and hopefully understanding, I first set the view of the module to register with attributes.
[ServiceLocatorRegistration(typeof(IRequiredModule), RegistrationType.Singleton, "SignalProcessing")]
public partial class SignalProcessingView : IRequiredModule
The view is a Catel UserControl. Then in the app.xaml.cs file I set the ServiceLocator to AutoRegisterTypesViaAttributes = true;
var test = ServiceLocator.Default;
test.AutoRegisterTypesViaAttributes = true;
When I run the program, the module isn't detected. I assume that I am missing something. Is there something like I do with MEF to tell the ServiceLocator where to find the modules? For example
// get the external modules
var moduleCatalog = new DirectoryCatalog("Modules", "*.dll");
var assemblyCatalog = new AssemblyCatalog(Assembly.GetExecutingAssembly());
var aggretate = new AggregateCatalog();
var container = new CompositionContainer(aggretate);
// satisfy exports and imports
// compose the modules
The other question is, how do I load the views after they have been composed by the ServiceLocator?
Please be kind if I have said or done anything stupid, this has been driving me crazy.
PS I am using the latest betas from nuget for Catel.