我可以创建一个移动“视图”吗?这不包含我现有 MVVM 代码中的 Silverlight?
在过去的一年里,我一直在使用 MVVM 模式在 Silverlight 中进行大量开发。我已经多次向我的项目经理推销 MVVM 通过职责分离的伟大之处,并且取得了一些巨大的成功,我在一天内重写了视图,而不是在一周内重写了应用程序。
最近,我们有一个“走向移动”的指令,它与尽可能多的移动浏览器兼容(例如,不是 Silverlight)。根据我之前的工作,我的项目经理假设我可以简单地为移动应用程序编写一个新的“视图”。
问题:
有没有办法能够将我现有的 MVVM 代码应用到不包含 Silverlight 的移动前端?
I'm in a situation where for the past year I've been developing heavily in Silverlight using the MVVM pattern. I've sold my project manager numerous times on the greatness of MVVM through its separation of duties, and have had some great successes where I've re-written views in a day, rather than re-writing the app in a week.
Recently we've had a directive to 'go mobile' that is compatible with as many mobile browsers as possible (eg. Not Silverlight). My project manager is under the assumption, based on my earlier work that I can simply write a new 'view' for mobile apps.
Question:
Is there a way to be able to apply my existing MVVM code to a mobile front-end that doesn't consist of Silverlight?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不这么认为。 MVVM 依赖于视图和视图模型之间通过通知、命令等进行的持续交互。
由于您的代码位于 .NET 中,因此无法在 Web 应用程序的客户端上运行它。
但是,您可以将一些 MVVM javascript 框架(如 KnockoutJS)与一些 MVC 框架结合使用(ASP.NET MVC 2 将是最简单的)过渡)。这是我能想到的最相似的方法,但是您需要迁移当前的应用程序。
I don't think so. MVVM relies on constant interaction between the view and the viewmodel through notifications, commands, etc.
Since your code is in .NET, there's no chance to run it on the client side in a web application.
You could however use some MVVM javascript framework like KnockoutJS in combination with some MVC framework (ASP.NET MVC 2 would be the easiest transition). This is the most similar approach I can think of, but you need to migrate your current applications.