开发在多个平台上运行的移动 C# 应用程序
我们有一个在 Windows Mobile 上运行的业务线应用程序。它是一个带有本地 SQL CE 数据库的 Winforms 应用程序,并从服务器上运行的 WCF Web 服务获取数据。
现在客户总是问“为什么不制作适用于 iPhone/iPad/Android/Phone 7 等的版本”。我的老板问这有多难。我最初的回答非常困难,特别是因为我可能是唯一做这项工作的人。除了 Visual Studio 之外,我没有任何经验。
现在我遇到了 MonoTouch 和 MonoDroid。他们似乎提供了一个简单的解决方案,但我确信存在很多问题。我怀疑我是否能够为 Android 编译我的应用程序。
我倾向于认为这将是太多的工作,唯一现实的解决方案是一个移动网站,每个页面有多个版本,用于不同的屏幕分辨率。不幸的是,现有的应用程序有一个本地数据库,并且“有时是连接的”,所以这不会削减它。
在我浪费大量时间之前有什么建议和提示吗?
干杯
标记
We have an line-of-business app that runs on Windows Mobile. It's a Winforms app with a local SQL CE database and gets its data from a WCF Web Service running on the server.
Now customers are always asking "why don't you make a version for iPhone/iPad/Android/Phone 7 etc". My boss asked how hard this would be. My initial answer is very hard especially since I would probably be the only person doing the work. I don't have any experience outside my Visual Studio happy place.
Now I've come across MonoTouch and MonoDroid. They appears to offer an easy solution but I'm sure there are lots of issues. I doubt that I will be able to just compile my app for Android.
I'm inclined to suggest that it would be far too much work and that the only realistic solution is a mobile web site with several versions of each page for different screen resolutions. Unfortunately the existing app has a local database and is "sometimes connected" so that won't cut it.
Any suggestions and tips before I waste a huge amount of time?
Cheers
Mark
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是正确的;你不会的。
那么,背景: MonoTouch 和 Mono for Android 旨在将“核心”.NET 和 C# 体验引入 iOS 和 Android,同时还公开每个特定平台的底层功能。而 PhoneGap 和 Titanium 抽象底层平台(实现“一次编写,随处运行”的氛围),MonoTouch 和 Mono for Android 不提供平台抽象并直接公开底层平台类型和成员。
结果是 MonoTouch 程序使用 MonoTouch.UIKit.UIButton,它直接包装底层 CocoaTouch UIButton 类型。
同样,Mono for Android 程序将使用 Android.App.Activity,直接包装底层 Android android.app.Activity 类型。
这两个平台的共同点是您在 .NET、.NET CF、Silverlight、Windows Phone 7 和 Mono 上找到的“核心”框架命名空间和类型:
System
、System.Collections.Generic
、System.Linq
(是的,Linq-to-Objects)、System.Xml.Linq
(是的,Linq-to-XML)、System.IO
等。例如,请参阅 Mono for Android 中包含的程序集< /a>.那么,您可以在 Android 上按原样使用现有的 Windows Mobile 应用程序吗?否,因为 Android 版 Mono 不提供 System.Windows.Forms。
但是,您应该可以重构现有代码以遵循模型/视图/控制器设计模式(或 MVVM,或...),抽象出 UI(视图),以便您可以将其替换为各种平台,例如带有 MonoTouch 的 iOS UI、带有 XAML 的 WP7 UI、带有 Mono for Android 的 Android UI、带有 ASP.NET MVC 的 HTML UI 等等。一次,随处运行”的体验,但您将能够为用户提供与其选择的平台一致的本机用户界面。
例如,请参阅 MIX11 会议应用,它利用通用代码库,同时为 iOS 提供特定于平台的 UI,安卓、WP7。
That is correct; you won't.
So, background: the design philosophy of MonoTouch and Mono for Android is to bring the "core" .NET and C# experience to iOS and Android while also exposing the underlying features of each specific platform. Whereas PhoneGap and Titanium abstract the underlying platform (for a "write-once, run-anywhere" vibe), MonoTouch and Mono for Android provide no platform abstractions and directly expose the underlying platform types and members.
The result is that MonoTouch programs use MonoTouch.UIKit.UIButton, which directly wraps the underlying CocoaTouch UIButton type.
Similarly, Mono for Android programs would use Android.App.Activity, which directly wraps the underlying Android android.app.Activity type.
Common across both platforms are the "core" framework namespaces and types which you find on .NET, .NET CF, Silverlight, Windows Phone 7, and Mono:
System
,System.Collections.Generic
,System.Linq
(yes, Linq-to-Objects),System.Xml.Linq
(yes, Linq-to-XML),System.IO
, etc., etc. For example, see the assemblies included in Mono for Android.So, can you use your existing Windows Mobile app as-is on Android? No, because Mono for Android doesn't provide
System.Windows.Forms
.However, it should be possible for you to refactor your existing code to follow a Model/View/Controller design pattern (or MVVM, or...), abstracting away the UI (View) so that you can replace it for various platforms, e.g. an iOS UI with MonoTouch, a WP7 UI with XAML, an Android UI with Mono for Android, an HTML UI with ASP.NET MVC, etc., etc. You won't get a "write once, run anywhere" experience, but you will be able to provide the user with native user interfaces which are consistent with their chosen platform.
For example, see the MIX11 Conference Apps, which utilize a common code base while providing platform-specific UIs for iOS, Android, and WP7.
看看钛合金和phonegap。
look at titanium and phonegap.
我的建议是快速浏览一下 WP7。它很容易上手,如果您有 Visual Studio(您确实有)和任何类型的 C# 经验,则更是如此。然后您应该能够更轻松地猜测开发 C# 应用程序需要多长时间(并且可能使用 MonoDroid 将其移植到 Android)。
是的,钛合金和钛合金。 PhoneGap 是个选择,但我个人认为 MonoDroid 看起来更好。
您收到最多请求的平台是什么?我猜测 Android,因为这似乎是最有可能的。我看到很多人都说 MonoDroid 非常可靠。
My suggestion is to have a quick look at WP7. It's quite easy to jump in to, even more so if you have Visual Studio (which you do) and C# experience of any sorts. Then you should be able to more easily guesstimate how long it would take you to develop a C# application (and possibly port that to Android using MonoDroid).
And yes, Titanium & PhoneGap are options, but I personally think MonoDroid looks better.
What platform are you getting the most requests for? I am guessing Android, as that seems the most likely. I have seen a lot of people saying MonoDroid is really solid.