Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
Cross-Platform Mobile Development with C# (MonkeySpace 2012)
Greg Shackles
October 18, 2012
Programming
3
1.6k
Cross-Platform Mobile Development with C# (MonkeySpace 2012)
Greg Shackles
October 18, 2012
Tweet
Share
More Decks by Greg Shackles
See All by Greg Shackles
Building Modern Services with .NET Core 3 and gRPC
gshackles
0
97
Observability-Driven Development: What DevOps is Really About
gshackles
1
220
Monitoring Your Mobile Apps in the Wild
gshackles
1
68
Building Scalable Applications with the Actor Model
gshackles
0
460
Creating a Voice-Driven TV Remote with Azure and Alexa
gshackles
0
63
Build 2017 Recap for Xamarin Developers
gshackles
0
74
Going Serverless: Event-Driven Architecture Without The Infrastructure
gshackles
0
140
Evolve 2016 Redux
gshackles
0
86
Instrumenting Your Mobile Monitoring Strategy
gshackles
0
4.4k
Other Decks in Programming
See All in Programming
Cross Deviceチームにおけるスマートテレビアプリ開発ってどんな感じ?
cokaholic
0
120
The strategies behind ddd – AdeoDevSummit 2022
lilobase
PRO
5
270
設計ナイト2022 トランザクションスクリプト
shinpeim
11
2.1k
Node-RED 3.0 新機能紹介
utaani
0
150
模組化的Swift架構(二) DDD速成
haifengkao
0
390
LINE Messaging APIの概要 - LINE API総復習シリーズ
uezo
1
190
Improving Developer Experience Through Tools and Techniques 2022
krzysztofzablocki
0
1.2k
大規模プロダクトにLinterを導入し運用している話
hirokiotsuka
0
240
オブジェクト指向で挫折する初学者へ
deepoil
0
200
Opsしかやってこなかった私が DevOpsが根付いたチームにJoinした話
yhamano
1
100
[DevTrends - Jun/2022] Arquitetura baseada em eventos
camilacampos
0
160
ゴーファーくんと辿るプログラミング言語の歴史/history-of-programming-languages-with-gopher
iwasiman
8
4.2k
Featured
See All Featured
Designing with Data
zakiwarfel
91
3.9k
The Pragmatic Product Professional
lauravandoore
19
3k
What's new in Ruby 2.0
geeforr
336
30k
Embracing the Ebb and Flow
colly
73
3.4k
Why Our Code Smells
bkeepers
PRO
324
55k
GitHub's CSS Performance
jonrohan
1020
420k
Making the Leap to Tech Lead
cromwellryan
113
7.4k
The Language of Interfaces
destraynor
148
20k
Automating Front-end Workflow
addyosmani
1351
200k
How to train your dragon (web standard)
notwaldorf
58
3.9k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
236
1M
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
10
3.5k
Transcript
Greg Shackles Cross-platform mobile development with c#
About Me Greg Shackles Senior Software Engineer OLO Online Ordering
email greg@gregshackles.com twitter @gshackles github github.com/gshackles blog gregshackles.com Slides speakerdeck.com/u/gshackles
nycmobiledev.net @NYCMobileDev
the Book oreil.ly/Lp5smR Discount Code: AUTHD Print Book: 40% Off
E-Book: 50% Off
Market Share (US): August 2012 Google Apple RIM Microsoft Symbian
52.6% Android 34.3% Apple 8.3% RIM 3.6% Microsoft Source: comScore
native platform Languages Objective-C Java C#
Write once, run anywhere
"The biggest mistake we made as a company was betting
too much on HTML5 instead of native." - Mark Zuckerberg
Embrace the differences != !=
c# Everywhere MonoTouch Mono for Android Native
The Power of C# •Base Class Library •LINQ •Parallel LINQ
•Memory Management •Task Parallel Library •Dynamic •Skill Reuse
xamarin Tools •Access to full platform SDKs •100% Native •Linker
•Debugging •frequent releases •active community •Improved API
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 var attr = new CFStringAttributes { Font = listLineCTFont, ForegroundColor = UIColor.Black.CGColor }; var astr = new NSAttributedString ("Hello World", attrs);
C# <activity android:name=".SampleActivity" android:label="@string/app_name">
<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 [Activity(Label="@string/AppName", MainLauncher=true)] FindViewById<Button>(Resource.Id.Button).Click += delegate { // handle click };
- - - - - - - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - UI and Platform Code Shared Code
What code can be shared? * with some limitations •Most
non-UI or platform code •Core application logic •Entities •LINQ (objects, XML) •Network access •File / Database Access *
sharing techniques •File Linking •Abstraction •Observer Pattern •Partial Classes and
Methods •Conditional Compilation •portable class libraries
library: xamarin.mobile Supports iOS, Android and Windows Phone xamarin.com/mobileapi
None
Case Study: iCircuit
http://praeclarum.org/post/31799384896/icircuit-code-reuse-the-fourth-edition 16% 84% Shared Platform 31% 69% 13% 87% iOS
WP7 Mac 19% 81% Android Case Study: iCircuit
Case Study: TouchDraw
http://lipsky.me/2012/9/11/touchdraw-code-reuse-updated 39% 61% Shared Platform 24% 76% 28% 72% iOS
Mac Android Case Study: TouchDraw
SignalR Client Libraries http://github.com/gshackles/SignalR C# To Go Mono.CSharp http://github.com/gshackles/CSharpToGo Case
Study: Class Libraries
Questions?