SlideShare a Scribd company logo
28 ottobre 2013
Bologna
#mobc2013
CROSS-PLATFORM
DEVELOPMENT WITH C# AND
XAMARIN
Luca Zulian
CR02
Dev4Side S.r.l, Developer
luca.zulian@dev4side.com
Giuseppe Marchi
Dev4Side 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 Use
Deploy to Device
Deploy to App Stores
Xamarin Studio
Unlimited App Size
Visual Studio Support
Business Features
Prime Components
Email Support
One Business Day SLA
Hotfixes
Technical Kick-off Session
Code 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 Conferences
www.technicalconferences.it
• Mobile Conference
www.mobileconference.it
• Dev4Side
www.dev4side.com
• PeppeDotNet
www.peppedotnet.it
• Queube
www.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.

More Related Content

Cross platform development with c# and xamarin

  • 3. CROSS-PLATFORM DEVELOPMENT WITH C# AND XAMARIN Luca Zulian CR02 Dev4Side S.r.l, Developer luca.zulian@dev4side.com Giuseppe Marchi Dev4Side S.r.l., CoFounder, Ceo giuseppe.marchi@dev4side.com
  • 4. 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
  • 5. Chi sono • Developer e Architect in Dev4Side S.r.l. • MCTS Web Application ASP.NET 4
  • 6. Agenda • Overview on mobile platforms and development • Xamarin Approach and Architecture • Cross-Platform development with Xamarin
  • 7. OVERVIEW ON MOBILE PLATFORM Rapid overview on mobile platform
  • 8. 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
  • 10. Write Apps Three Times – Native Approach
  • 11. 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
  • 12. I am going crazy
  • 14. Ok I have the answer
  • 15. Write Once, run Anywhere? UX in Android != iOS != Windows Phone
  • 16. 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)
  • 18. 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
  • 20. Xamarin Architecture • Layers • Separation of Responsibility • Encapsulation • Code Core Sharing
  • 21. 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
  • 22. Xamarin App – Compile and Run APPS ARE STILL COMPLETELY NATIVE!!!
  • 23. Xamarin Studio IDE • FEATURES • Unified Search • Find and Replace • Code Navigation • Code Completion • Debugger • Breakpoints • Watches • Refactoring Support • Source Control
  • 24. Xamarin Visual Designer • Immagine delle schermate di MyTasks con vs e xamarin studio
  • 25. DEMO
  • 27. 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
  • 28. 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/)
  • 29. DEMO
  • 30. 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.
  • 31. Pricing • Mono is an open source project. The Mono virtual machine is licensed under the LGPLv2 license Permitted Use Deploy to Device Deploy to App Stores Xamarin Studio Unlimited App Size Visual Studio Support Business Features Prime Components Email Support One Business Day SLA Hotfixes Technical Kick-off Session Code Troubleshooting
  • 32. 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
  • 34. Links • Technical Conferences www.technicalconferences.it • Mobile Conference www.mobileconference.it • Dev4Side www.dev4side.com • PeppeDotNet www.peppedotnet.it • Queube www.queube.com
  • 35. Grazie.Non dimenticare di riempire il modulo di feedback CR02
  • 37. © 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.