. NET platform for development of Windows Phone 7, iPhone and Android applications

Source: Internet
Author: User
Tags visual studio 2010

Editor's note: After the release of Windows Phone 7, the mobile development industry, except for the iPhone and Android
It will be clear that more and more developers begin
7. Platform transfer. This article, written by Zhao Yu, a famous developer for infoq, details the Modern. Net DDD recently held
At the Conference, Chris hard, a famous developer, demonstrated how to develop Windows Phone-Oriented Systems Based on. NET/C #.
7. Applications on the iPhone and Android platforms, as well as precautions.

First, Chris lists the utilities and frameworks used on the three platforms and other peripheral environments:

  Windows Phone 7 IPhone (monotouch) Android (monodroid Preview)
Operating System Windows Mac Cross-platform
Development Tools Visual Studio 2010 Monodevelop Vs 2010/monodevelop
Design Tools Expression blend 4 Interface Builder XML file/droiddraw
Development Framework Silverlight for WP Superset of Silverlight 3 Superset of Silverlight 3
Community information Excellent Better Shang Zao

IPhone vs Windows Phone 7 vs android

Monotouch is a mono-based iPhone launched by Novell.
The OS application development kit can publish applications to the Apple App Store. Mono is A. Net runtime environment developed based on The ECMA standard, using JIT (Just-in-
Time) Compilation Method to execute the Il code, but because the iPhone
OS device restrictions, monotouch uses the AOT (ahead-of-time) Compilation Method to directly deploy native code to the iPhone
OS devices (iPhone, iPhone
4, iPad. Monotouch also provides a linker that links some of the static links actually used in the SDK and program code to the application, thus reducing
Volume. Applications developed using monotouch can be stored on the iPhone
The operating system runs independently. This is because monotouch puts a runtime inside the application. According to Chris, this will increase the application volume by about 6 MB.

Using monotouch,. Net/C # programmers can use existing knowledge for development and use reflection, generics, LINQ, lambda, and other advanced. net
/C # features. Native API-oriented bindings are stored in the monotouch namespace in monotouch. dll, and are used with cocoatouch (that is, for iPhone
Native objective-C framework developed by OS. Monotouch does not expose cocoa directly during binding.
Touch function, but to a certain extent, rewrite its API to a more inclined form of. Net programmers. For example, the frame attribute of uiview is
System. Drawing. rectanglef type, not Cocoa
The original cgrect in touch. For some types such as nsarray, monotouch also converts them to strongly typed arrays in a proper place. In the debugging party
Monotouch uses the soft-debugger of Mono and supports debugging on simulators, real machines, and even through WiFi.

Monodroid is an application development kit for Android systems. It is basically the same as monotouch. It is currently in the preview and release stage, and only a few early-subscribed users get the SDK.

According to Chris, a considerable amount of code can be reused with monotouch and monodroid, including existing open-source projects, such as JSON. net,
And xnatouch. Xnatouch is a monotouch-based xNa Framework implementation that simplifies Xbox and Windows Phone
7 game porting to iPhone OS. However, binary files cannot be shared during reuse, but code must be re-compiled for different platforms.

In the UI section, the three platforms have their own native solutions. Besides Windows Phone
In addition, iPhone and Android use the C # binding of the native API provided by monotouch and monodroid for development. For example, monotouch
During the development of the line UI, the architecture of the iPhone OS standard application is used, including the MVC driver mode. Developers can use the interface
Builder edits the XIB file. monotouch will automatically generate C # code in a local Class Based on the XIB content. All outlet, action, and other elements will be in the code.

Chris also mentioned other areas where specific code must be written for the platform. For example, in the file storage, monotouch and monodroid can write data directly like a local path, in Windows Phone 7, independent storage must be used:

  1. Void savelocal (string data)
  2. {
  3. # If (monotouch | monodroid)
  4. File. writealltext (_ localpath, data );
  5. # Elif windows_phone
  6. Using (VAR appstorage =
  7. Isolatedstoragefile. getuserstoreforapplication ())
  8. {
  9. Var file = appstorage. openfile (_ localpath, filemode. Create );
  10. Fileextension. writealltext (file, data );
  11. }
  12. # Endif
  13. }

Similarly, when you use WebClient to obtain data, you can directly call the downloadfile Method on monotouch and monodroid to download the file. In Windows Phone 7, you need to use the openread method to process the binary data stream.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.