Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: How to create a separate XAP file using Prism/MEFBootstrapper for a complex Child Window?

$
0
0

Hi Warren,

I know its very confusing. Here is what I mean. The handle you are looking for is thecontract name of your exports. And as you can see we are not forcing the shell to know the concrete type of your childwindow, by which I mean any other special interface local to the childwindow module. All you need to know is the export contract.

[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...");// At this point your childwinodw properties will be populatedif (ErrorWindow != null&& evt.Error != null) ErrorWindow.Show();if (SMMMessageWindow != null) SMMMessageWindow.Show();
   };
 };
}

[Import("SMMMessageWindow")]public ChildWindow SMMMessageWindow { get; set; }

[Import("ErrorWindow")]public ChildWindow ErrorWindow { get; set; }

Your module would look like this

namespace SharedForms
{
   [Export(typeof(SharedFormsModule))]publicclass SharedFormsModule: IModule, ISharedFormsModule
   {publicvoid Initialize()
      {
      }
   }
}

Try this out and let me know.

Cheers!


Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>