C# and .NET on

wrackbaaΚινητά – Ασύρματες Τεχνολογίες

10 Δεκ 2013 (πριν από 3 χρόνια και 9 μήνες)

132 εμφανίσεις

C# and .NET on

iOS

and Android

16 January 2012

Joseph Hill

joseph@xamarin.com

COO/Co
-
Founder

Overview


The story so far…


Mono on the Mac


MonoTouch



Mono for Android


Mono on Windows

The story so far…

What is Mono
?


Open source implementation of the .NET
platform


2001: Created to bring Windows applications
to Linux


2003: Acquired by Novell with
Ximian


Matured at Novell in research mode; now a
world
-
class runtime.

C#

Java

JavaScript

Ruby

Python

Visual Basic

F#

May 2011: Attachmate


May 2
nd
: Attachmate buys Novell


Mono team laid off


Xamarin

founded 2 weeks later


Angry Mono customers pressure Novell to
cooperate with
Xamarin


Xamarin secures a perpetual license to all
Mono IP: copyrights, patents and trademarks

C#

Java

JavaScript

Ruby

Python

Visual Basic

F#

MonoTouch

What is
MonoTouch
?


What is
MonoTouch
?


C# on the
iPhone



What is it not?


Silverlight for the
iPhone


Compact Framework for the
iPhone


iPhone

development without a Mac


A meta
-
platform

Amazing App Store apps:
xamarin.com
/apps

Enterprise?
apple.com
/
ipad
/business/profiles/
medtronic
/

Ahead
-
of
-
Time Compilation



Apple disallows Just
-
in
-
Time compilation


Cannot execute writeable memory


Enforced by OS



Mono has batch compilation


Similar to
ngen


All possible code paths must be generated at build
time



Native ARM

binary

Mono Runtime (AOT)

IL

(.NET
Bytecode
)

Cross
-
Compiler


(
mtouch
)

MonoTouch

APIs



mscorlib


System


System.Core

(LINQ)


System.Data


Mono.Data.Sqlite


System.ServiceModel


System.Json


System.Web.Services


WCF


System.Xml


System.Xml.Linq

.NET APIs



AddressBook
/

AddressBookUI


AudoToolbox
/

AVFoundation


CoreAnimation


CoreGraphics


CoreLocation


GameKit


MediaPlayer


MessageUI


StoreKit


UIKit


Native APIs



MonoTouch.Dialog


OpenTK


OpenGL


OpenAL



s
qlite
-
net


MonoGame

(
XnaTouch
)


CocosNet


RestSharp


ServiceStack


Steema

TeeChart


Flurry Analytics


RedLaser


3
rd

Party

Other Features


Services:


Garbage collected system


Interoperability with other libraries


P/Invoke


btouch


Thread pool management


Size:


2 megabyte runtime


Linker



Application + Libraries
+

Base Class Libraries

Mono Linker

Your App

Uses
Mono.Cecil

to

Removes Dead Code

(Mark & Sweep)

Mono Linker

Mono for Android

Mono for Android


Does not require a Mac


First
-
Class Visual Studio Support


MonoDevelop

on Windows

and Mac


JIT (Just in Time compilation)


Potential to support all .NET languages


Shared Runtime for Development


APK includes Mono + Linked Assemblies


(Same as
MonoTouch
, but with JIT support)




Mono for Android Architecture

Code Sharing and Native Experience

Win/WP7

WPF

Silverlight

OSX

MonoMac

C#

Plus ECMA languages

.NET

iOS

MonoTouch

Android

Mono for
Android

Mono

Business Logic and Middleware

(engine, core and 3
rd

party)

Native UI
APIs

Runtime

OS

MonoTouch
/
iPhone

80%+ .NET re
-
use

Native User Experience

Silverlight/
WP7

80%+
.NET re
-
use

Native User Experience

Mono for
Android

80%+
.NET re
-
use

Native User Experience

Native Library Support


C/C++
-

P/Invoke


Objective
-
C


btouch


http://ios.xamarin.com/Documentation/Binding_
New_Objective
-
C_Types


http://code.google.com/p/btouch
-
library/


Java


jni

/ jar2xml


https://github.com/xamarin/jar2xml




Code sharing


DLL must be compiled for target


WP7/
iOS
/Android have different base class libraries


We’re working to bridge the gap


Just added Isolated Storage


Xamarin Mobile Extensions


Business logic can be shared


Portable Library Tools can help


http://visualstudiogallery.msdn.microsoft.com/b0e0b5e9
-
e138
-
410b
-
ad10
-
00cb3caf4981


Project Linker can help


http://visualstudiogallery.msdn.microsoft.com/5e730577
-
d11c
-
4f2e
-
8e2b
-
cbb87f76c044


Abstraction
p
atterns exist


http://code.google.com/p/monocross/wiki/MonoCross






Xamarin Mobile API

More online


xamarin.com
/apps


xamarin.com
/
monotouch


xamarin.com
/android


docs.xamarin.com


twitter.com
/
xamarin_com