cross platform development with c# and xamarin

37
28 ottobre 2013 Bologna

Upload: luca-zulian

Post on 13-Jan-2017

522 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: Cross platform development with c# and xamarin

28 ottobre 2013Bologna

Page 2: Cross platform development with c# and xamarin

#mobc2013

Page 3: Cross platform development with c# and xamarin

CROSS-PLATFORM DEVELOPMENT WITH C# AND XAMARINLuca Zulian

CR02

Dev4Side S.r.l, Developer

[email protected]

Giuseppe MarchiDev4Side S.r.l., CoFounder, Ceo

[email protected]

Page 4: Cross platform development with c# and xamarin

Chi sono

• Fondatore di Dev4Side S.r.l.• Microsoft MVP su SharePoint da 3 anni• Speaker per eventi Microsoft ed eventi Community in Italia• MCP, MCPD Web applications, MCTS ASP.NET 4, WSS 3.0, MOSS

2007 e SharePoint 2010• SharePointer dal lontano 2005• Padre di www.peppedotnet.it • Autore del libro «Pocket C#» edito da Apogeo• Membro attivo, speaker e promotore di SharePointCommunity.it• Il primo in Italia ad aver messo un’App sull’Office Store• Uno dei TOP 25 SharePoint Influencers in Europa

Page 5: Cross platform development with c# and xamarin

Chi sono

• Developer e Architect in Dev4Side S.r.l.

• MCTS Web Application ASP.NET 4

Page 6: Cross platform development with c# and xamarin

Agenda

• Overview on mobile platforms and development• Xamarin Approach and Architecture

• Cross-Platform development with Xamarin

Page 7: Cross platform development with c# and xamarin

OVERVIEW ON MOBILE PLATFORM Rapid overview on mobile platform

Page 8: Cross platform development with c# and xamarin

Over 2.6 billion of mobile devices

By 2016, 70% of the mobile workforce will have a smartphone, and 90% of enterprises will have two or more platforms to support

Page 9: Cross platform development with c# and xamarin

Some statistics…

Page 10: Cross platform development with c# and xamarin

Write Apps Three Times – Native Approach

Page 11: Cross platform development with c# and xamarin

Development on iOS • Mac OS X • XCode • Objective-C• iOS SDK• Apple Tools

Development on Android

Development on Windows Phone

• OS indipendent • Eclipse, IntelliJ IDEA or Android Studio or…• Java• Android SDK• SDK Tools

• Windows OS• Visual Studio • C#• .NET Framework• Windows Phone SDK

Page 12: Cross platform development with c# and xamarin

I am going crazy

Page 13: Cross platform development with c# and xamarin

The answer?

Page 14: Cross platform development with c# and xamarin

Ok I have the answer

Page 15: Cross platform development with c# and xamarin

Write Once, run Anywhere?

UX in Android != iOS != Windows Phone

Page 16: Cross platform development with c# and xamarin

Ipse dixit: Martin Fowler

• Don’t use cross platform toolkits• UI Translation leads to fatal compromises in

user-experience • Build a native app for that platform, with a

experience design based on that platforms interaction style

(link here: http://martinfowler.com/bliki/CrossPlatformMobile.html)

Page 17: Cross platform development with c# and xamarin

Why Xamarin? (part 1)

Page 18: Cross platform development with c# and xamarin

Why Xamarin? (part 2)

• Your C# apps on 2.6 billion devices.• Amazing IDE (Available on Windows and Mac)• Integrated with Microsoft (Visual Studio)• Always up-to-date• Finish your app faster (With a library of pre-built

components)• Complete Documentation• Training and Support• Over 400.000 Developers in the World

Page 19: Cross platform development with c# and xamarin

XAMARIN APPROACH AND ARCHITECTURE

Page 20: Cross platform development with c# and xamarin

Xamarin Architecture

• Layers• Separation of Responsibility• Encapsulation• Code Core Sharing

Page 21: Cross platform development with c# and xamarin

Benefits

• Accelerate time to market• Start now with existing team• C# and .NET are mature and powerful• Usage of C# feature (async, LINQ, generics etc.)• Skill reuse on all platform• Engaging, native experience• Code can be reused across platforms (even non-

mobile platform!)• Integrate with existing enterprise architecture

Page 22: Cross platform development with c# and xamarin

Xamarin App – Compile and Run

APPS ARE STILL COMPLETELY NATIVE!!!

Page 23: Cross platform development with c# and xamarin

Xamarin Studio IDE

• FEATURES• Unified Search• Find and Replace• Code Navigation• Code Completion• Debugger• Breakpoints• Watches• Refactoring

Support• Source Control

Page 24: Cross platform development with c# and xamarin

Xamarin Visual Designer

• Immagine delle schermate di MyTasks con vs e xamarin studio

Page 25: Cross platform development with c# and xamarin

DEMO

Page 26: Cross platform development with c# and xamarin

CROSS-PLATFORM DEVELOPMENT WITH XAMARIN

Page 27: Cross platform development with c# and xamarin

Setting Up A Xamarin Cross Platform Solution (part 1)• Code sharing

• File Linking into each App Project• File Linking to Separate Projects• Clone Project Files

• Populating the Solution• Core project - Write re-usable code in one place,• Platform-specific application projects - Platform-specific features are added at this level

• Project References

• Adding Files

Page 28: Cross platform development with c# and xamarin

Setting Up A Xamarin Cross Platform Solution (part 2)• Handling Platform Divergence & Features

• Platform Abstraction

• Identify fundamental elements that exist across platforms• Platform-specific attributes• Device-specific features• PreProcessor directives

• Separate common logic from UI (Interfaces, Inheritance, Base Classes etc)• MonoTouch.Dialog and MonoDroid.Dialog• Xamarin.Mobile

• Divergent Implementation• Conditional Compilation

• Xamarin.* Libraries & Components

• MonoCross Framework (https://code.google.com/p/monocross/)

Page 29: Cross platform development with c# and xamarin

DEMO

Page 30: Cross platform development with c# and xamarin

What I need to use Xamarin?

• Xamarin development can be done in either Xamarin Studio or Visual Studio. The IDE you choose will be determined by the platforms you wish to target.

• Because Windows Phone apps can only be developed on Windows, it is impossible to develop for all three platforms on the same operating system.

Page 31: Cross platform development with c# and xamarin

Pricing• Mono is an open source project. The Mono virtual machine is licensed under the LGPLv2 license

Permitted UseDeploy to DeviceDeploy to App StoresXamarin StudioUnlimited App SizeVisual Studio SupportBusiness FeaturesPrime ComponentsEmail SupportOne Business Day SLAHotfixesTechnical Kick-off SessionCode Troubleshooting

Page 32: Cross platform development with c# and xamarin

Resources to Start

• Last Xamarin Conference (http://xamarin.com/evolve/2013)

• Stack Overflow / Mailing List• Xamarin samples (http://docs.xamarin.com/samples-all)• Xamarin forum (http://forums.xamarin.com/)• GitHub (https://github.com/xamarin)• Books

Page 33: Cross platform development with c# and xamarin

QUESTIONS&

ANSWERS

Page 34: Cross platform development with c# and xamarin

Links

• Technical Conferenceswww.technicalconferences.it

• Mobile Conferencewww.mobileconference.it

• Dev4Sidewww.dev4side.com

• PeppeDotNetwww.peppedotnet.it

• Queubewww.queube.com

Page 35: Cross platform development with c# and xamarin

Grazie.Non dimenticare di riempire il modulo di feedback

CR02

Page 36: Cross platform development with c# and xamarin

#mobc2013

Page 37: Cross platform development with c# and xamarin

© EventHandler S.r.l. All rights reserved. Microsoft, Windows and all other trademarks and copyrights are the property of their respective owners. EventHandler cannot guarantee the accuracy of any information provided after the date of this presentation. EVENTHANDLER MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.