Cross platform development with c# and xamarin

Post on 13-Jan-2017

523 views 1 download

transcript

28 ottobre 2013Bologna

#mobc2013

CROSS-PLATFORM DEVELOPMENT WITH C# AND XAMARINLuca Zulian

CR02

Dev4Side S.r.l, Developer

luca.zulian@dev4side.com

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

giuseppe.marchi@dev4side.com

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

Chi sono

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

• MCTS Web Application ASP.NET 4

Agenda

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

• Cross-Platform development with Xamarin

OVERVIEW ON MOBILE PLATFORM Rapid overview on mobile platform

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

Some statistics…

Write Apps Three Times – Native Approach

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

I am going crazy

The answer?

Ok I have the answer

Write Once, run Anywhere?

UX in Android != iOS != Windows Phone

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)

Why Xamarin? (part 1)

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

XAMARIN APPROACH AND ARCHITECTURE

Xamarin Architecture

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

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

Xamarin App – Compile and Run

APPS ARE STILL COMPLETELY NATIVE!!!

Xamarin Studio IDE

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

Support• Source Control

Xamarin Visual Designer

• Immagine delle schermate di MyTasks con vs e xamarin studio

DEMO

CROSS-PLATFORM DEVELOPMENT WITH 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

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/)

DEMO

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.

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

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

QUESTIONS&

ANSWERS

Links

• Technical Conferenceswww.technicalconferences.it

• Mobile Conferencewww.mobileconference.it

• Dev4Sidewww.dev4side.com

• PeppeDotNetwww.peppedotnet.it

• Queubewww.queube.com

Grazie.Non dimenticare di riempire il modulo di feedback

CR02

#mobc2013

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