Download presentation
Presentation is loading. Please wait.
1
Cross-platform mobile development with c#
Greg Shackles - June 12, 2012
2
About Me Greg Shackles email twitter github blog Slides
Senior Software Engineer OLO Online Ordering twitter @gshackles github github.com/gshackles blog gregshackles.com Slides speakerdeck.com/u/gshackles
3
the Book oreil.ly/Lp5smR Discount Code: AUTHD Print Book: 40% Off
E-Book: 50% Off
4
Market Share (US): April 2012
50.8% Android 31.4% Apple 11.8% RIM 4.0% Microsoft Source: comScore
5
native platform Languages
Objective-C Java C#
6
Write once, run anywhere
7
platform differences != !=
8
c# Everywhere MonoTouch Mono for Android Native
9
The Power of C# Base Class Library LINQ Parallel LINQ
Memory Management Task Parallel Library Dynamic
10
xamarin Tools Access to full platform SDKs 100% Native Linker
frequent releases active community Improved API xamarin.com
11
obj-c C# CFStringRef keys[] = { kCTFontAttributeName,
kCTForegroundColorAttributeName }; CFTypeRef bval[] = { cfListLineCTFontRef, CGColorGetConstantColor(kCGColorBlack) attr = CFDictionaryCreate ( kCFAllocatorDefault, (const void **) &keys, (const void **) &bval, sizeof(keys) / sizeof(keys[0]), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); astr = CFAttributedStringCreate( kCFAllocatorDefault, CFSTR("Hello World"), attr); obj-c C# var attrs = new CFStringAttributes { Font = listLineCTFont, ForegroundColor = UIColor.Black.CGColor }; var astr = new NSAttributedString ("Hello World", attrs);
12
Java C# <activity android:name=".SampleActivity“
<intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> findViewById(R.id.button).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) // handle click } ); Java C# MainLauncher=true)] FindViewById<Button>(Resource.Id.Button).Click += delegate { // handle click };
13
Environment: iOS Xcode Integration Mac OS X MonoDevelop
14
Environment: android Mac OS X MonoDevelop Windows Visual Studio
15
UI Designer: MonoDevelop and Visual Studio
Environment: android UI Designer: MonoDevelop and Visual Studio
16
Environment: windows phone
Visual Studio
17
Some Apps ...and many more! icircuit rdio gmusic c# to go
infinite flight mwc 2012
18
even non-mobile platforms!
Benefits Powerful and mature language Skill reuse Native apps Code reuse across platforms even non-mobile platforms!
19
app Architecture
20
* with some limitations
What code can be shared? Most non-UI or platform code Core application logic Entities LINQ (objects, XML) Network access File / Database Access * * with some limitations
21
* currently in development
sharing techniques File Linking Abstraction Observer Pattern Partial Classes and Methods Conditional Compilation portable class libraries * * currently in development
22
library: xamarin.mobile
Supports iOS, Android and Windows Phone xamarin.com/mobileapi
23
Demo Time
24
Questions?
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.