/// <summary> /// Creates a new instance of <see cref="ModuleHost"/>. When using startup args in your application, you can pass these args /// through to <see cref="ModuleHost"/> so they can be inspected by any <see cref="Module"/> which may require them. /// </summary> /// <param name="args">Arguments to pass to modules.</param> public ModuleHost(string[] args = null) { if (args != null) { Arguments = args; } else { Arguments = new List <string>(); } var eventCollection = new EventCollection(this); var moduleCollection = new ModuleCollection(this); // Create the events tracking list and a readonly wrapper to pass in the IModuleHost.EventsInProgress property. // We do this here since Host starts throwing a few LoggingEvent events into the system while importing and // loading, etc... _EventsInProgress = new Dictionary <string, IEvent>(); _ReadOnlyEventsInProgress = new ReadOnlyDictionary <string, IEvent>(_EventsInProgress); eventCollection.ImportEvents(); moduleCollection.ImportModules(); _EventCollection = eventCollection; _ModuleCollection = moduleCollection; }
/// <summary> /// Creates a new instance of <see cref="ModuleHost"/>. When using startup args in your application, you can pass these args /// through to <see cref="ModuleHost"/> so they can be inspected by any <see cref="Module"/> which may require them. /// </summary> /// <param name="args">Arguments to pass to modules.</param> public ModuleHost(string[] args = null) { if (args != null) { Arguments = args; } else { Arguments = new List <string>(); } var eventCollection = new EventCollection(this); var moduleCollection = new ModuleCollection(this); moduleCollection.ImportModules(); eventCollection.ImportEvents(); _EventCollection = eventCollection; _ModuleCollection = moduleCollection; // Create the events tracking list and a readonly wrapper to pass in the IModuleHost.EventsInProgress property. _EventsInProgress = new Dictionary <string, IEvent>(); _ReadOnlyEventsInProgress = new ReadOnlyDictionary <string, IEvent>(_EventsInProgress); }