重用MonoTouch的code在MonoDroid的应用 [英] Reusing Monotouch code in Monodroid app

查看:184
本文介绍了重用MonoTouch的code在MonoDroid的应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在实施最终将被移植到一个MonoDroid的应用MonoTouch的。应用仅仅是一个客户到一个OData的Web服务。没有什么太花哨或性能的关键。

I'm currently implementing a Monotouch application that will eventually be ported to Monodroid. The application is just a client to an OData Web service. Nothing too fancy or performance critical.

的挑战是重用尽可能多code越好。我知道,对于MonoTouch的和MonoDroid的用户界面API的有很大的不同,但我希望能重用数据数据抽象层和业务层。

The challenge is to reuse as much code as possible. I'm aware that the UI APIs for Monotouch and Monodroid are quite different, but I'm hoping to to reuse the data data abstraction and business layers.

由于我的UI层沿用了MVP模式,我也希望通过编码每个视图的抽象重新presentation重用UI控制器。但是,我只能猜测这是否会工作,因为我还没有允许在MonoDroid的测试版。

Since my UI layer follows the MVP pattern, I also hope to reuse UI controllers by coding an abstract representation of each view. However, I can only guess if this will work since I am not yet allowed to the Monodroid beta.

现在我的问题:


  • 你怎么看待这种做法?这是一个好主意,否则只会导致平庸的应用程序,因为在IPhone和Android的UI概念区别在哪里?

  • What do you think about this approach? Is this a good idea, or will it just lead to a mediocre application because of differences in the UI concept between IPhone and Android?

可以提供如何构建应用程序,最大限度code再使用任何提示?

Can you offer any hints on how to structure the application to maximize code re-use?

谢谢,

阿德里安

推荐答案

我要说的是后者,但你绝对可以重复使用您的业务和域对象的很大一部分。同样的单声道SQLite是在MonoDroid的使用,所以数据持久性的应用程序的一部分(如果它使用)被重复使用的。

What do you think about this approach? Is this a good idea, or will it just lead to a mediocre application because of differences in the UI concept between IPhone and Android?

I would say the latter, but you can definitely re-use a large portion of your business and domain objects. The same Mono Sqlite is used in Monodroid, so the data persistence part of your app (if it uses that) is re-usable.

我不会理会建立一个中间层的用户界面 - 这两者是完全不同的。例如在Android应用你有底部菜单,它可以包含在屏幕上6个按钮。在iPhone上你更可能不会在标签栏或工具栏6个按键。为了让一个常见的​​模式为不会帮助你多少。

I wouldn't bother creating a middle layer UI - the two are completely different. For example on Android apps you have the bottom menu, which can contain 6 buttons on screen. On the iPhone you are more than likely not to have 6 buttons in a tab bar or toolbar. To make a common pattern for that won't help you much.

另一个例子是列表视图(UITableViews)。他们是完全不同的。正如你所期望的MonoDroid的实施是忠实于它丑陋的Java妹妹。在Android上你不必在您使用间接苹果力巨大的纠结,而只是一个简单的ArrayAdapter作为数据源 - 子类更复杂的布局

Another example is ListViews (UITableViews). They're completely different. As you'd expect the Monodroid implementation is faithful to its ugly Java sister. On Android you don't have to use the huge tangle of indirection that Apple force upon you, but just a simple ArrayAdapter as the data source - subclassed for more complicated layouts.

需要注意的另一个重要的事情就是 Android不有一个屏幕尺寸即可。您可以为 3不同屏幕密度的创建图像。字体大小都不是绝对的。

Another important thing to note is Android doesn't have one screen size. You create images for 3 different screen densities. Font sizes aren't absolute.

Android版为您提供了类似于XAML和网络布局的机制,在iPhone上你没有那么幸运(或者更幸运的是,这取决于你如何看待它),因为一切都一般绝对定位(他们能做到这一点,因为它总是320×480)。

Android provides you with layout mechanisms similar to XAML and the web, on the iPhone you're not so lucky (or more fortunate, depending how you view it) as everything is generally absolutely positioned (they can do this as it's always 320x480).

我想你已经得到了大多数的覆盖与数据分离层和坚持控制器。没有看到你的应用程序很难说它多么容易会被重新使用控制器(不管你使用UITableViews或定制用户界面),但Android是如此之快发展与我想它应该是一个快速的任务。

I think you've got most of covered with separate layers for the data and sticking to controllers. Without seeing your app it's hard to say how easy it will be re-use the controllers (whether you use UITableViews or custom uis), but Android is so much faster to develop with I think it should be a quick task.

<子>(我在MonoDroid的preVIEW,也有一个MT应用程式出来)

这篇关于重用MonoTouch的code在MonoDroid的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆