Silverlight 浏览器外与多目标 WPF
我正在启动一个新项目,主要是 silverlight Web 应用程序。但是,它还需要作为独立的桌面应用程序运行。
我计划将该项目基于 Prism 4.0。它提供了有关在 silverlight 和 WPF 之间共享“多目标”应用程序代码的指导。如果我理解正确,我可以使用 MVVM 为相同的视图模型和底层服务创建单独的 silverlight 和 WPF 视图。
我想知道,当 silverlight 现在可以作为浏览器外应用程序运行时,创建额外视图是否真的值得额外的工作。我是否无法将应用程序的桌面版本与 IIS Express 捆绑在一起并在本地托管 silverlight 应用程序?这似乎是一件相当容易做的事情。我确信我可以在 WPF 中以不同的方式做一些视觉上引人注目的事情,但就我而言 - Web 版本将占据 90% 的使用量,因此重点显然是 silverlight。如果我们必须维护两组独立的视图,我可以定期看到 WPF 版本落后于 silverlight 版本。
在数据方面,我已经发现我可以将实体框架配置为与桌面版本的 SQL CE 4.0 一起使用。即使我们使用 WPF,我也会这样做,所以它实际上只涉及表示层。
回顾一下,问题很简单:IIS Express + Silverlight OOB 是否是 Silverlight 和 WPF 多目标的可行替代方案?
I'm starting a new project that is primarily a silverlight web application. However, it also needs to run as a stand-alone desktop application.
I'm planning on basing the project on Prism 4.0. It provides guidance around sharing code between silverlight and WPF for a "multi-targeted" application. If I understand correctly, I can use MVVM to create separate silverlight and WPF views for the same view-models and underlying services.
I'm wondering though if it is really worth the extra work to create the extra views, when silverlight can now be run as an out-of-browser application. Couldn't I bundle the desktop version of my app with IIS Express and host the silverlight app locally? It seems like a fairly easy thing to do. I'm sure there are some visually compelling things I can do differently in WPF, but in my case - the web version is where 90% of the usage is going to be, so the focus is clearly on silverlight. If we have to maintain two separate sets of views, I can see the WPF version trailing behind the silverlight version on a regular basis.
On the data side of things, I've already figured out that I can configure Entity Framework to work with SQL CE 4.0 for the desktop version. I would do this even if we used WPF, so it's really just down to the presentation layer.
So to recap, the question is simply this: Is IIS Express + Silverlight OOB a viable alternative to multi-targeting both Silverlight and WPF?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只要您可以忍受沙箱限制,纯 Silverlight 版本的设置很可能会更好。需要测试的不太明显的代码总是一件好事。您尚未指定应用程序正在做什么,但只要它不需要访问(大多数)本地设备、不受限制的文件系统访问或任何其他 SL4 沙箱限制(您也可以通过 COM 互操作来解决这些限制) ,但是哎哟),您只需使用浏览器内和浏览器外部署设置来执行应用程序的一个版本就可以了。
More than likely, the Silverlight-only version setup would be better, as long as you can live with the sandbox restrictions. Less distinct code to test is always a Good Thing. You haven't specified what the app is doing, but as long as it doesn't need access to (most) local devices, unrestricted filesystem access, or any of the other SL4 sandbox restrictions (which you could also get around with COM interop, but ouch), you should be fine just doing one version of the app with in- and out-of-browser deployment setups.
浏览器外的 silverlight 应用程序听起来非常适合您的需求。您可能不想尝试捆绑 IIS Express 和 SQL CE,而是想看看用于本地的 SterlingDB 之类的东西数据存储。如果您正在调用 Web 服务,则启用“完全信任”标志运行的浏览器外应用程序没有跨域限制。这样,您的应用程序将是纯粹的 silverlight,并且您的部署和部署将是纯粹的 silverlight。更新方案将非常简单(通过网站单击安装)。
A silverlight out of browser app sounds perfect for your needs. Rather than trying to bundle IIS express and SQL CE, you might want to take a look at something like SterlingDB for local data storage. If you are calling web services, out-of-browser applications running with the "full trust" flag enabled don't have cross-domain restrictions. This way, your app would be pure silverlight, and your deployment & update scenarios would be very straightforward (single-click install via a website).