1 / 24

Greg Shackles - June 12, 2012

Cross-platform mobile development with c#. Greg Shackles - June 12, 2012. 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.

skip
Download Presentation

Greg Shackles - June 12, 2012

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Cross-platform mobile development with c# Greg Shackles - June 12, 2012

  2. 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

  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. 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. <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 C# [Activity(Label="@string/AppName", MainLauncher=true)] FindViewById<Button>(Resource.Id.Button).Click += delegate { // handle click };

  13. Environment: iOS Xcode Integration Mac OS X MonoDevelop

  14. Environment: android MonoDevelop Mac OS X Visual Studio Windows

  15. Environment: android UI Designer: MonoDevelop and Visual Studio

  16. Environment: windows phone Windows Visual Studio

  17. Some Apps icircuit rdio gmusic c# to go ...and many more! infinite flight mwc 2012

  18. Benefits • Powerful and mature language • Skill reuse • Native apps • Code reuse across platforms even non-mobile platforms!

  19. app Architecture

  20. 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. 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?

More Related