Silverlight PRISM 加载外部 XAP 模块
我不确定这是否可行,但我目前正在从主应用程序程序集中加载大部分模块,我现在正在尝试加载外部 XAP 模块。
我有这样的事情:
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);
然后我意识到您不能使用该引用,因为它使用本地文件访问,而这在 Silverlight 中不可用。这对我有用的唯一原因是我直接引用了我需要删除的主题项目。我想将其指向 http://localhost/Theme_External.xap 或远程网址后来就下线了。
我可以使用当前的 PRISM 设置执行此操作吗?
感谢您抽出时间
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_External.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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Dave 所说的...
如果它不明显,您需要做的唯一更改(假设您的 xap 文件位于同一目录中)是将 ref 属性设置为
:在比 shell xap 文件低的目录中。如果没有,您将需要绝对网址。
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:
Reletive urls will work if it's in a directory lower than your shell xap file. If not, you'll need the absolute url.
您可以按需下载 XAP 文件,只要它们与主应用程序位于同一域中即可。 此处有一篇有关 Silverlight 中动态数据交付的综合文章。
如果您想下载托管在不同域上的 XAP 文件,则必须拥有 跨域策略文件 在该域上。
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.