构建一个适用于 WP7、Iphone 和 WP7 的应用程序安卓
我即将开始构建一个可在所有平台上使用的应用程序。我将使用 monotouch 和 monodriod,这样我就可以将东西保留在 .net 中。
我有点懒,所以我希望能够重用尽可能多的代码。
假设我想创建一个存储联系信息的应用程序。例如姓名和电话号码
我的应用程序需要能够从 Web 服务检索数据并在本地存储数据。
MVVM 模式看起来像是可行的方法,但我不确定下面的方法是否 100% 正确,
这是正确的吗?
- 包含我的模型的项目
- 包含我的视图、本地存储方法以及我将视图绑定到的视图模型的项目。在这种情况下,将有 3 个基于 3 个操作系统的不同项目
- 用于绑定到服务和本地数据存储的数据访问层项目
任何建议都会很棒。
感谢您抽出时间
I am about to start building an app that will be used across all platforms. I will using monotouch and monodriod so I can keep things in .net
I'm a little lazy so I want to be able to reuse as much code as possible.
Lets say I want to create an application that stores contact information. e.g. Name & Phone number
My application needs to be able to retrieve data from a web service and also store data locally.
The MVVM pattern looks like the way to go but im not sure my approach below is 100% correct
Is this correct?
- A project that contains my models
- A project that contains my views,local storage methods and also view models which I bind my views to. In this case there would be 3 different projects based on the 3 os's
- A data access layer project that is used for binding to services and local data storage
Any suggestions would be great.
Thanks for your time
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
没有具体回答你的问题,但这里有一些懒惰的指针......
更新 - 我不敢相信我只是偶然发现了自己的答案...:) 除了这个答案之外,您可能还想看看 MonoCross 和 MvvmCross - 毫无疑问还有很多其他混合平台:
Not specifically answering your question, but here are some lazy pointers...
Update - I can't believe I just stumbled across my own answer... :) In addition to this answer, you might want to look at MonoCross and MvvmCross - and no doubt plenty of other hybrid platforms on the way:
Jonas Follesoe 的跨平台开发演讲:成为目前最全面的资源。他谈论了如何最好地共享代码和资源,抽象出大部分 UI 和 UX 差异,展示了跨平台可行的 MVVM 可重用用法,以及用于组合几乎自动化构建的出色技术。 (是的,这包括一种在 Visual Studio 上编译单点触控内容的方法)
最重要的是,他拥有成品的可用源代码以及单独放置在自己的研讨会项目中的许多主要组件的源代码,以及详细说明执行步骤的 50 多页 pdf。github 上的 FlightsNorway
IMO 唯一缺少的是如何最好地处理跨所有平台的本地数据存储。在这种情况下,我会引导您访问 Vici Cool Storage 一个可以与 WP7 一起使用的 ORM, MonoTouch 和(虽然没有官方支持)MonoDroid。
*免责声明* 站点文档不是最新的,但源代码可用。 (因为文档对于许多程序员来说就是 Kriptonite)
Jonas Follesoe's cross platform development talk: Has to be the most comprehensive resource out there at the moment. He talks about how best to share code and resources, abstract out much of the UI and UX differences, shows viable reusable usage of MVVM across platforms and nice techniques for putting together an almost automated build. (yes, that includes a way for you to compile you monotouch stuff on Visual Studio)
Best of all he has a available source code for the finished product and for a number of the major component individually placed in its own workshop project and a 50 + page pdf detailing the steps to do so.FlightsNorway on github
IMO the only thing missing is how best to handle local data storage across all platforms. In which case I would direct you to Vici Cool Storage an ORM that can work with WP7, MonoTouch and (while not officially supported) MonoDroid.
*Disclaimer* The site documentation isn't the most updated but the source code is available. (Because documentation is Kriptonite to many a programmer)
我认为编写一次代码并使其在所有三个平台上运行的最简单方法可能是基于 Web 的应用程序。例如,请查看 Untappd。
I think the easiest way to write the code once and have it work on all three platforms will probably be a web-based application. Check out Untappd for example.
您可以首先查看 Robert Kozak 的 MonoTouch MVVM 框架。但这只是一个开始。
MonoTouch MVVM
You can start by looking at Robert Kozak's MonoTouch MVVM framework. It's just a start though.
MonoTouch MVVM