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