Hi,
I dont understand why yiu are importing the childwindows in the imodule implementation. And also why are you importing the sharedformmodule? Just to access the childwindow properties?
Move those 2 childwindow properties in your shell. And on module download completed those properties should be available. You dont need to import the sharedformsmodule at all.
From: highdownts
Hello,
I have created a small test solution to debug the Prism/Child Window code. I believe the MEFBootstrapper is working properly. The Shell code executes to the LoadModuleCompleted event shown in the code below. You mentioned that the only way to use the exported child windows is to import them. Are you saying that I need to add a hardcoded dependency to import either of the two child windows? Is there a way to use Prism to access the module and then its two properties without adding a dependency? I tried adding a library reference to the SharedForms project and importing (one at a time) the SharedFormsModule and then the two child window properties, but this does not seem to work. Can you please explain how to import the two child windows?
For example, I get an exception using the following syntax for the module or its properties.
[Import(typeof(SharedFormsModule))]
publicSharedFormsModule SharedFormsModule;
[Import(typeof(IModule))]
publicIModule errowWindow;
[Import("ErrorWindow",typeof(ChildWindow))]
publicChildWindow errowWindow;
This is the Shell code.
[ImportingConstructor]
public Shell(IModuleManager ModuleManager,IModuleCatalog moduleCatalog)
{
InitializeComponent();
this.ModuleManager = ModuleManager;
this.moduleCatalog = moduleCatalog;
this.Loaded += (s, ev) =>
{
var module = moduleCatalog.Modules.Single(m => m.ModuleName.Equals("SharedFormsModule"));
if (module !=null&& module.State == ModuleState.NotStarted)
ModuleManager.LoadModule("SharedFormsModule");
ModuleManager.LoadModuleCompleted += (sn, evt) =>
{
MessageBox.Show("Module Loaded...");
// ... How to access either of the two child windows???
};
};
}
This is the child window project.
namespace SharedForms
{
[Export(typeof(SharedFormsModule))]
publicclassSharedFormsModule:IModule, ISharedFormsModule
{
publicvoid Initialize()
{
}
[Import("SMMMessageWindow",typeof(ChildWindow))]
publicChildWindow SMMMessageWindow { get; set; }
[Import("ErrorWindow",typeof(ChildWindow))]
publicChildWindow ErrorWindow { get; set; }
}
}
Read the full discussion online.
To add a post to this discussion, reply to this email (CompositeWPF@discussions.codeplex.com)
To start a new discussion for this project, email CompositeWPF@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com