cross platform mobile development with.net greg shackles senior software engineer olo online...

36
Cross Platform Mobile Development with .NET Greg Shackles Senior Software Engineer OLO Online Ordering [email protected]

Upload: pablo-herald

Post on 11-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Cross Platform Mobile Development with .NET

Greg ShacklesSenior Software Engineer

OLO Online [email protected]

Page 2: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

MARQUEE SPONSOR

Page 3: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

PLATINUM SPONSOR

Page 4: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

PLATINUM SPONSOR

Page 5: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

GOLD SPONSOR

Page 6: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

GOLD SPONSOR

Page 7: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

GOLD SPONSOR

Page 8: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

GOLD SPONSOR

Page 9: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

GOLD SPONSOR

Page 10: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

GOLD SPONSOR

Page 11: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

SILVER SPONSORS

Page 12: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Who is this guy?

• Greg Shackles• [email protected]• gregshackles.com• Twitter: @gshackles• Google+: plus.tl/gshackles• github.com/gshackles

Page 13: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

C# To Go

• http://shackl.es/CSharpToGo

Page 14: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Market Share (US)

Page 15: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Platform Languages

Page 16: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Cross Platform Solutions

and many more…

Page 17: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Spoiler Alert

Page 18: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Different Platforms are…Different

!= !=

Page 19: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com
Page 20: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

.NET to the Rescue!

Page 21: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

What is Mono?

• Implementation of the .NET CLR• Open source• Cross platform• Supports most of .NET 4.0• mono-project.com

Page 22: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

MonoTouch

• Bindings to CocoaTouch• .NET – LINQ, generics, etc (Moonlight)• AOT compilation• Linker• Memory management• Integrates with Interface Builder• ios.xamarin.com

Page 23: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Mono for Android

• Wraps Java/Android API• .NET – LINQ, generics, etc (Moonlight)• Linker• Visual Studio 2010 or MonoDevelop• android.xamarin.com• http://xamarin.com/androidbeta

Page 24: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Mono for Android Architecture

• Android/Managed Callable Wrappers• JNI bridges to talk between Android and Mono

Page 25: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Mono for Android API

• .NET events replace listener interfaces• Action replaces Runnable• Enumerations• Properties• Attributes and tooling generate configuration• Uses standard Android resource files

Page 26: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Why?

Page 27: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com
Page 28: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Sharing

Page 29: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Reusability Story

UI

C#

Runtime

Platform

Silverlight

Business Logic

.NET

WP7 iOS

Mono

Android

MonoTouch Mono for Android

Page 30: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Platform Comparison

• UI• Tooling– IDE– Designer– Emulator

• Multitasking / Lifecycle• Storage– File system– Database

• Shared Resources

Page 31: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Comparison: Views

WP7 iOS Android

Format XAML XIB XML

Screen PhoneApplicationPage UIViewController Activity

Layout StackPanel N/A (manual) LinearLayout

List ListBox UITableView ListView

List Item ListBox.ItemTemplate UITableViewCell View

Data Source Binding UITableViewSource BaseAdapter

Page 32: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Comparison: Navigation

Windows Phone 7

NavigationService.Navigate( new Uri("/NextPage.xaml?id=42", UriKind.Relative)));

iOS

NavigationController.PushViewController( new NextController(42), true);

Android

var intent = new Intent(); intent.SetClass(this, typeof (NextActivity)); intent.PutExtra(“id", 42);StartActivity(intent);

Page 33: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Code Sharing Techniques

• Link files• Preprocessor directives

#if MONOTOUCH

• Messaging (publish/subscribe)• Abstraction• Third party libraries– sqlite-net– TinyIoC / TinyMessenger– MonoMobile.Extensions

Page 34: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

NYC Code Camp App

Page 35: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

App Architecture

Entities DataAccess Libraries Messaging ViewModels

CC.Core.MonoTouch CC.Core.MonoAndroid CC.Core.WP7

CodeCamp.Core

App.MonoTouch App.MonoAndroid App.WP7

Page 36: Cross Platform Mobile Development with.NET Greg Shackles Senior Software Engineer OLO Online Ordering greg@gregshackles.com

Questions?

15% Discount - Expires 10/31https://store.xamarin.com/?discount=NYC-Code-Camp-6