views:

736

answers:

2

Hi,

I'm not sure if this is possible, but I am currently loading most of my modules from within the main application assembly, I am trying to now load external XAP modules.

I have something like this:

ModuleInfo themeModule = new ModuleInfo();
    themeModule.ModuleName = "Theme_External";
    themeModule.ModuleType = "Theme_External.Theme_External_Module, Theme_External, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null";
    themeModule.Ref = "file://Theme_External.xap";
    themeModule.InitializationMode = InitializationMode.OnDemand;
    catalog.AddModule(themeModule);

I then realised that you cannot use that ref as it uses local file access which is not available in Silverlight. The only reason this was working for me is I had a direct reference to the theme project which I needed to remove. I'd like to either point it at say http://localhost/Theme%5FExternal.xap or a remote web address later down the line.

Is this something I can do with the current PRISM set up?

Thanks for your time

+1  A: 

You can download XAP files on demand as long as they are in the same domain as the primary application. There is a comprehensive article on Dynamic Data Delivery in Silverlight here.

If you want to download a XAP file hosted on a different domain, you'll have to have a Cross-Domain Policy file on that domain.

Dave Swersky
+1  A: 

What Dave said...

and in case it isn't obvious, the only change you'd need to make (assuming that your xap files are in the same directory) is to set the ref property to:

themeModule.Ref = "Theme_External.xap";

Reletive urls will work if it's in a directory lower than your shell xap file. If not, you'll need the absolute url.

Raumornie