Federico,
Thank you for your help. I have a couple of issues that are stopping me from getting to my ultimate goal.
Thank you for your help. I have a couple of issues that are stopping me from getting to my ultimate goal.
-
On all of the Logger.Log lines, I am getting a Resource error. My system is not recognizing the Resources.LoggerCreatedSuccessfully
Is this a file that I should be creating with constants. -
My bigger issue involves the CreateModuleCatalog. I might not have explained myself correctly in the initial issue.
Here is what I want my CreateModuleCatalog to do.protected override IModuleCatalog CreateModuleCatalog() { ModuleCatalog modules = new ModuleCatalog(); modules.AddModule(typeof(NSAMedia.VendorAutomation.Modules.VendorDetail.VendorDetailModule)); if (userPrincipal.UserID != 3417) { modules.AddModule(typeof(NSAMedia.VendorAutomation.Modules.VendorSelection.VendorSelectionModule)); } modules.AddModule(typeof(NSAMedia.VendorAutomation.Modules.ProductSelection.ProductSelectionModule)); modules.AddModule(typeof(NSAMedia.VendorAutomation.Modules.ProductDetails.ProductDetailsModule)); return modules; }
public override void Run(bool runWithDefaultConfiguration)
{
//this.useDefaultConfiguration = runWithDefaultConfiguration;
ServiceLocator.Current.GetInstance<IEventAggregator>().GetEvent<UserInitialized>().Subscribe(this.UserDone);
}
public void UserDone(UserPrincipal user)
{
ServiceLocator.Current.GetInstance<IEventAggregator>().GetEvent<UserInitialized>().Unsubscribe(this.UserDone);
this.Logger = this.CreateLogger();
if (this.Logger == null)
{
//throw new InvalidOperationException(Resources.NullLoggerFacadeException);
}
//this.Logger.Log(Resources.LoggerCreatedSuccessfully, Category.Debug, Priority.Low);
//this.Logger.Log(Resources.CreatingModuleCatalog, Category.Debug, Priority.Low);
this.ModuleCatalog = this.CreateModuleCatalog();
if (this.ModuleCatalog == null)
{
//throw new InvalidOperationException(Resources.NullModuleCatalogException);
}
//this.Logger.Log(Resources.ConfiguringModuleCatalog, Category.Debug, Priority.Low);
this.ConfigureModuleCatalog();
//this.Logger.Log(Resources.CreatingUnityContainer, Category.Debug, Priority.Low);
this.Container = this.CreateContainer();
if (this.Container == null)
{
//throw new InvalidOperationException(Resources.NullUnityContainerException);
}
//this.Logger.Log(Resources.ConfiguringUnityContainer, Category.Debug, Priority.Low);
this.ConfigureContainer();
//this.Logger.Log(Resources.ConfiguringServiceLocatorSingleton, Category.Debug, Priority.Low);
this.ConfigureServiceLocator();
//this.Logger.Log(Resources.ConfiguringRegionAdapters, Category.Debug, Priority.Low);
this.ConfigureRegionAdapterMappings();
//this.Logger.Log(Resources.ConfiguringDefaultRegionBehaviors, Category.Debug, Priority.Low);
this.ConfigureDefaultRegionBehaviors();
//this.Logger.Log(Resources.RegisteringFrameworkExceptionTypes, Category.Debug, Priority.Low);
this.RegisterFrameworkExceptionTypes();
//this.Logger.Log(Resources.CreatingShell, Category.Debug, Priority.Low);
this.Shell = this.CreateShell();
if (this.Shell != null)
{
//this.Logger.Log(Resources.SettingTheRegionManager, Category.Debug, Priority.Low);
RegionManager.SetRegionManager(this.Shell, this.Container.Resolve<IRegionManager>());
//this.Logger.Log(Resources.UpdatingRegions, Category.Debug, Priority.Low);
RegionManager.UpdateRegions();
//this.Logger.Log(Resources.InitializingShell, Category.Debug, Priority.Low);
this.InitializeShell();
}
if (this.Container.IsRegistered<IModuleManager>())
{
//this.Logger.Log(Resources.InitializingModules, Category.Debug, Priority.Low);
this.InitializeModules();
//this.Logger.Log(Resources.BootstrapperSequenceCompleted, Category.Debug, Priority.Low);
}
}
protected override void ConfigureContainer()
{
Container.RegisterInstance(typeof(UserPrincipal), userPrincipal, new ContainerControlledLifetimeManager());
base.ConfigureContainer();
}
protected override IModuleCatalog CreateModuleCatalog()
{
ModuleCatalog modules = new ModuleCatalog();
modules.AddModule(typeof(NSAMedia.VendorAutomation.Modules.VendorDetail.VendorDetailModule));
if (userPrincipal.UserID != 3417)
{
modules.AddModule(typeof(NSAMedia.VendorAutomation.Modules.VendorSelection.VendorSelectionModule));
}
modules.AddModule(typeof(NSAMedia.VendorAutomation.Modules.ProductSelection.ProductSelectionModule));
modules.AddModule(typeof(NSAMedia.VendorAutomation.Modules.ProductDetails.ProductDetailsModule));
return modules;
}