SlideShare ist ein Scribd-Unternehmen logo
1 von 17
GETTING STARTED WITH 
XAMARIN FORMS 
Writing native mobile apps using our C# skills
What is this Xamarin thing? 
• Brings the .NET Framework to mobile devices 
• Based upon Mono, an open source .NET runtime 
• Supports Android, iOS, Windows Phone, OSX 
• Supports the latest version of C# (5.0, including async/await) 
• Supports development in VS2012/13 but also includes their own IDE (Xamarin Studio) 
• Uses the native APIs/UI widgets 
• With every release of an API/OS level, the Xamarin team ensures that there’s a managed 
wrapper 
• Kept current (supported iOS8 on day 1, already includes Android L) 
• It’s a commercial product 
• Free (Starter) edition is very limited 
• 30-day trial available for testing/proof-of-concept work
Why should I be interested in Xamarin? 
• Allows us to write in one language (C#) for all platforms 
• Android uses Java 
• iOS uses Objective C 
• Windows Phone uses C# 
• But wait: isn’t PhoneGap one language? 
• Most C# developers aren’t familiar enough with Javascript to write non-trivial apps 
• Javascript can be hard to debug (see: Chris’ talk) 
• WebView-hosted Javascript can be even harder to debug 
• Extensions (aka Plugins) must be written in the native languages 
• HTML is not a native UI 
Write once, run everywhere! 
(no, really!)
Aha! But I still have to learn the platform’s UI! 
• Enter Xamarin Forms 
• Rather than requiring you to learn three different ways to express your UI, learn one: XAML 
• Reasonable level of component support (this *is* a 1.0…) 
• Uses a language we’re already reasonably familiar with (XML + syntax extensions) 
• Native API support means you still have access to the low-level UI 
components if/when you need them 
• Can compose new controls from sets of existing controls 
• Can modify the look/feel of existing controls 
• Can build entirely new controls with native Renderers 
• Can mix and match Forms and low-level in the same application
DEMO: GETTING TO KNOW YOU 
Creating our first Visual Studio project
Extensible Application Markup Language (XAML) 
• A way to express application UI layout in XML 
• Started out as a feature of WPF 
• Supports a high degree of composition 
• Turned out to be quite useful 
• Xamarin’s XAML dialect isn’t the same as WPF/Silverlight 
• It’s pretty similar; the learning curve is short if you’re already familiar with WPF/Silverlight 
• Doesn’t have the same feature set (e.g.: styles, behaviors not available yet) 
• Continually growing 
• http://developer.xamarin.com/guides/cross-platform/xamarin-forms/controls/views/
DEMO: USING XAML FOR YOUR UI 
Creating a simple XAML form
Binding 
• XAML supports data and command binding 
• This is huge! 
• Not every in-box control supports it, though  
• Can specify one-way, two-way directional binding 
• Syntax is an extension of XML 
• <SomeControl SomeValue="{Binding PropertyName}"/> 
• Applies to properties and events (via commands) 
• Allows separation of Presentation and Behavior 
• Declare your UI completely in XAML 
• Have all logic live in code 
• This is different from code-behind!
The Model-View-ViewModel (MVVM) Pattern 
• Model 
• Your data; typically objects retrieved from Web services, databases, etc. 
• Should contain just the state and any data validation code 
• View 
• Your presentation layer 
• Has no awareness of data classes; relies completely on binding for input/output/interaction 
• ViewModel 
• The “meat” of the application – contains interaction logic, fetch/save calls, any 
transformation from data-to-UI structures 
• Inherits INotifyPropertyChanged for property change notification to the view 
• Exposes ICommand properties for Command objects 
• Several prebuilt frameworks (MVVMLight, MVVMCross, etc.)
DEMO: ADDING A VIEWMODEL 
Using a UI-independent object to manage state
A Recipe for Successful MVVM 
• Use bindings for everything 
• The UI should be dumb as a post; have all logic in the ViewModel 
• Any code in the form’s codebehind should be UI-specific (layout, behaviors) 
• Have the ViewModel supply everything the view needs 
• No data fetching (e.g. drop-down lists) in the UI; expose a property from the VM 
• “Ready” pattern – bind IsVisible/IsEnabled to a “Ready” property 
• INotifyPropertyChanged 
• The ViewModel should either implement INotifyPropertyChanged or (even better) use a 
framework like MVVMLight & ViewModelBase 
• Whenever a property changes, fire PropertyChanged 
• Be careful when the model is complex; you may need to fire PropertyChanged for multiple 
properties from one change!
Why should you take on the overhead of MVVM? 
• Supports multiple views with the same logic 
• Settings, user profile 
• Different layouts by orientation 
• Supports a designer/developer workflow 
• Designer works on layout/themes, developer works on logic 
• To be perfectly honest, we’re not quite there yet 
• Testing! 
• Code-behind means you can’t test logic without loading the UI 
• Unit tests of ViewModels can verify logic without having to know layout 
• You can use mock objects to simulate behaviors that are hard to duplicate when running the 
app (network failures, service errors, etc.)
ViewModel + Unit Tests = BFF!!! 
• Efficient develop/test/debug cycle 
• You can now verify behavior without having to run the app and manually enter data 
• You can run a suite of tests with every build 
• Interfaces + Dependency Injection + Mocks 
• Allows you to get very far without needing an actual service 
• Edge-case/validation tests 
• Fault injection tests 
• Gives us a warm sense of security! 
• A lot less head-scratching if something fails at runtime 
• A much better indication of whether changes broke something
DEMO: UNIT TESTING OUR 
VIEWMODEL 
Building a set of xUnit tests for our ViewModel
Unit Testing Rules of Thumb 
• Design for Testability 
• Use interfaces for any services you use 
• Separate interfaces and data contracts from implementation 
• Use dependency injection to get references at runtime 
• Choose a portable framework 
• NUnit 
• XUnit 
• NOT MSTest 
• Unit test failures should break the build 
• Code coverage is nice, but there be dragons
How can I get started? 
• Request a trial license from Xamarin 
• You may want to use a VM for this… 
• Business Edition required for Visual Studio support 
• $1000/platform (!) 
• Purchase an “Indie” license 
• $30/month (again, per platform) 
• Have to use Xamarin Studio 
• Publishing apps requires a bit more… 
• Apple Developer program is $100/yr. 
• Google Play registration is $25 (one-time)
QUESTIONS?

Weitere ähnliche Inhalte

Was ist angesagt?

Supercharge xamarin forms with custom renderers and animations
Supercharge xamarin forms with custom renderers and animationsSupercharge xamarin forms with custom renderers and animations
Supercharge xamarin forms with custom renderers and animationsTom Walker
 
Titanium: Native Mobile Apps with Javascript
Titanium: Native Mobile Apps with Javascript Titanium: Native Mobile Apps with Javascript
Titanium: Native Mobile Apps with Javascript Leonardo Farias
 
DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012kittenthecat
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahiericjamesblackburn
 
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...Sébastien Levert
 
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure FunctionsSharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure FunctionsSébastien Levert
 
WPF with MVVM: From the Trenches
WPF with MVVM: From the TrenchesWPF with MVVM: From the Trenches
WPF with MVVM: From the TrenchesBrent Edwards
 
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...Sébastien Levert
 
Mobile App Development Using Appcelerator and DNN WebAPIs
Mobile App Development Using Appcelerator and DNN WebAPIsMobile App Development Using Appcelerator and DNN WebAPIs
Mobile App Development Using Appcelerator and DNN WebAPIsDNN
 
Mvvm knockout vs angular
Mvvm knockout vs angularMvvm knockout vs angular
Mvvm knockout vs angularBasarat Syed
 
Managing SharePoint Anywhere with Windows PowerShell
Managing SharePoint Anywhere with Windows PowerShellManaging SharePoint Anywhere with Windows PowerShell
Managing SharePoint Anywhere with Windows PowerShellRyan Dennis
 
Dnn connect dnnmobi-slides
Dnn connect dnnmobi-slidesDnn connect dnnmobi-slides
Dnn connect dnnmobi-slidesashishpd
 
Building iOS App Project & Architecture
Building iOS App Project & ArchitectureBuilding iOS App Project & Architecture
Building iOS App Project & ArchitectureMassimo Oliviero
 
Joomla! multiplied - How to run Multi-Sites - JandBeyond 2014
Joomla! multiplied - How to run Multi-Sites - JandBeyond 2014Joomla! multiplied - How to run Multi-Sites - JandBeyond 2014
Joomla! multiplied - How to run Multi-Sites - JandBeyond 2014Viktor Vogel
 
Xamarin - Why I started learning it?
Xamarin - Why I started learning it?Xamarin - Why I started learning it?
Xamarin - Why I started learning it?Ankit Kashyap
 
La vita nella corsia di sorpasso; A tutta velocità, XPages!
La vita nella corsia di sorpasso; A tutta velocità, XPages!La vita nella corsia di sorpasso; A tutta velocità, XPages!
La vita nella corsia di sorpasso; A tutta velocità, XPages!Ulrich Krause
 
Build 2017 - Whats new for Xamarin Devs
Build 2017 - Whats new for Xamarin DevsBuild 2017 - Whats new for Xamarin Devs
Build 2017 - Whats new for Xamarin DevsMike James
 
Cross Platform Development in C# (DDDNorth 2013)
Cross Platform Development in C# (DDDNorth 2013)Cross Platform Development in C# (DDDNorth 2013)
Cross Platform Development in C# (DDDNorth 2013)ross.dargan
 
Figma design tool - an alternative for windows users
Figma design tool - an alternative for windows usersFigma design tool - an alternative for windows users
Figma design tool - an alternative for windows usersAugustina Reipšlėger
 

Was ist angesagt? (20)

Supercharge xamarin forms with custom renderers and animations
Supercharge xamarin forms with custom renderers and animationsSupercharge xamarin forms with custom renderers and animations
Supercharge xamarin forms with custom renderers and animations
 
Titanium: Native Mobile Apps with Javascript
Titanium: Native Mobile Apps with Javascript Titanium: Native Mobile Apps with Javascript
Titanium: Native Mobile Apps with Javascript
 
Webinar MVC6
Webinar MVC6Webinar MVC6
Webinar MVC6
 
DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012DeveloperDeveloperDeveloper! Sydney 2012
DeveloperDeveloperDeveloper! Sydney 2012
 
Test Automation with Twist and Sahi
Test Automation with Twist and SahiTest Automation with Twist and Sahi
Test Automation with Twist and Sahi
 
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
 
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure FunctionsSharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
 
WPF with MVVM: From the Trenches
WPF with MVVM: From the TrenchesWPF with MVVM: From the Trenches
WPF with MVVM: From the Trenches
 
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
 
Mobile App Development Using Appcelerator and DNN WebAPIs
Mobile App Development Using Appcelerator and DNN WebAPIsMobile App Development Using Appcelerator and DNN WebAPIs
Mobile App Development Using Appcelerator and DNN WebAPIs
 
Mvvm knockout vs angular
Mvvm knockout vs angularMvvm knockout vs angular
Mvvm knockout vs angular
 
Managing SharePoint Anywhere with Windows PowerShell
Managing SharePoint Anywhere with Windows PowerShellManaging SharePoint Anywhere with Windows PowerShell
Managing SharePoint Anywhere with Windows PowerShell
 
Dnn connect dnnmobi-slides
Dnn connect dnnmobi-slidesDnn connect dnnmobi-slides
Dnn connect dnnmobi-slides
 
Building iOS App Project & Architecture
Building iOS App Project & ArchitectureBuilding iOS App Project & Architecture
Building iOS App Project & Architecture
 
Joomla! multiplied - How to run Multi-Sites - JandBeyond 2014
Joomla! multiplied - How to run Multi-Sites - JandBeyond 2014Joomla! multiplied - How to run Multi-Sites - JandBeyond 2014
Joomla! multiplied - How to run Multi-Sites - JandBeyond 2014
 
Xamarin - Why I started learning it?
Xamarin - Why I started learning it?Xamarin - Why I started learning it?
Xamarin - Why I started learning it?
 
La vita nella corsia di sorpasso; A tutta velocità, XPages!
La vita nella corsia di sorpasso; A tutta velocità, XPages!La vita nella corsia di sorpasso; A tutta velocità, XPages!
La vita nella corsia di sorpasso; A tutta velocità, XPages!
 
Build 2017 - Whats new for Xamarin Devs
Build 2017 - Whats new for Xamarin DevsBuild 2017 - Whats new for Xamarin Devs
Build 2017 - Whats new for Xamarin Devs
 
Cross Platform Development in C# (DDDNorth 2013)
Cross Platform Development in C# (DDDNorth 2013)Cross Platform Development in C# (DDDNorth 2013)
Cross Platform Development in C# (DDDNorth 2013)
 
Figma design tool - an alternative for windows users
Figma design tool - an alternative for windows usersFigma design tool - an alternative for windows users
Figma design tool - an alternative for windows users
 

Ähnlich wie Getting started with Xamarin forms

A Smooth Transition to HTML5
A Smooth Transition to HTML5A Smooth Transition to HTML5
A Smooth Transition to HTML5Chris Bannon
 
Real World Windows Phone Development
Real World Windows Phone DevelopmentReal World Windows Phone Development
Real World Windows Phone DevelopmentIgor Kulman
 
Cross platform Xamarin Apps With MVVM
Cross platform Xamarin Apps With MVVMCross platform Xamarin Apps With MVVM
Cross platform Xamarin Apps With MVVMJim Bennett
 
A Smooth Transition to HTML5 Using MVVM
A Smooth Transition to HTML5 Using MVVMA Smooth Transition to HTML5 Using MVVM
A Smooth Transition to HTML5 Using MVVMChris Bannon
 
Eclipse Testing Day 2010. Xored Q7
Eclipse Testing Day 2010. Xored Q7Eclipse Testing Day 2010. Xored Q7
Eclipse Testing Day 2010. Xored Q7platoff
 
Develop business apps cross-platform development using visual studio with x...
Develop business apps   cross-platform development using visual studio with x...Develop business apps   cross-platform development using visual studio with x...
Develop business apps cross-platform development using visual studio with x...Alexander Meijers
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using XamarinGill Cleeren
 
Patterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 appsPatterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 appsPhil Leggetter
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Phil Leggetter
 
Xamarin.Forms Bootcamp
Xamarin.Forms BootcampXamarin.Forms Bootcamp
Xamarin.Forms BootcampMike Melusky
 
Transitioning Groupon to Node.js - EmpireJS 2014
Transitioning Groupon to Node.js - EmpireJS 2014Transitioning Groupon to Node.js - EmpireJS 2014
Transitioning Groupon to Node.js - EmpireJS 2014Sean McCullough
 
Cross platform mobile app development with Xamarin
Cross platform mobile app development with XamarinCross platform mobile app development with Xamarin
Cross platform mobile app development with XamarinPranav Ainavolu
 
Acing application lifecycle management in SharePoint
Acing application lifecycle management in SharePointAcing application lifecycle management in SharePoint
Acing application lifecycle management in SharePointJeremy Thake
 
Highlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conferenceHighlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conferenceChristopher Miller
 
Development Workshop on ET1, Android and Motorola RhoElements
Development Workshop on ET1, Android and Motorola RhoElementsDevelopment Workshop on ET1, Android and Motorola RhoElements
Development Workshop on ET1, Android and Motorola RhoElementsRomin Irani
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applicationsJulien Dubois
 
Mobile App Landscape for the Non-Technical
Mobile App Landscape for the Non-TechnicalMobile App Landscape for the Non-Technical
Mobile App Landscape for the Non-TechnicalJames Quick
 
Post Windows Mobile: New Application Development Platforms
Post Windows Mobile: New Application Development PlatformsPost Windows Mobile: New Application Development Platforms
Post Windows Mobile: New Application Development PlatformsBarcoding, Inc.
 

Ähnlich wie Getting started with Xamarin forms (20)

A Smooth Transition to HTML5
A Smooth Transition to HTML5A Smooth Transition to HTML5
A Smooth Transition to HTML5
 
Real World Windows Phone Development
Real World Windows Phone DevelopmentReal World Windows Phone Development
Real World Windows Phone Development
 
Cross platform Xamarin Apps With MVVM
Cross platform Xamarin Apps With MVVMCross platform Xamarin Apps With MVVM
Cross platform Xamarin Apps With MVVM
 
A Smooth Transition to HTML5 Using MVVM
A Smooth Transition to HTML5 Using MVVMA Smooth Transition to HTML5 Using MVVM
A Smooth Transition to HTML5 Using MVVM
 
Eclipse Testing Day 2010. Xored Q7
Eclipse Testing Day 2010. Xored Q7Eclipse Testing Day 2010. Xored Q7
Eclipse Testing Day 2010. Xored Q7
 
Develop business apps cross-platform development using visual studio with x...
Develop business apps   cross-platform development using visual studio with x...Develop business apps   cross-platform development using visual studio with x...
Develop business apps cross-platform development using visual studio with x...
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using Xamarin
 
Patterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 appsPatterns and practices for building enterprise-scale HTML5 apps
Patterns and practices for building enterprise-scale HTML5 apps
 
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
Using BladeRunnerJS to Build Front-End Apps that Scale - Fluent 2014
 
ASP.NET
ASP.NETASP.NET
ASP.NET
 
Training: MVVM Pattern
Training: MVVM PatternTraining: MVVM Pattern
Training: MVVM Pattern
 
Xamarin.Forms Bootcamp
Xamarin.Forms BootcampXamarin.Forms Bootcamp
Xamarin.Forms Bootcamp
 
Transitioning Groupon to Node.js - EmpireJS 2014
Transitioning Groupon to Node.js - EmpireJS 2014Transitioning Groupon to Node.js - EmpireJS 2014
Transitioning Groupon to Node.js - EmpireJS 2014
 
Cross platform mobile app development with Xamarin
Cross platform mobile app development with XamarinCross platform mobile app development with Xamarin
Cross platform mobile app development with Xamarin
 
Acing application lifecycle management in SharePoint
Acing application lifecycle management in SharePointAcing application lifecycle management in SharePoint
Acing application lifecycle management in SharePoint
 
Highlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conferenceHighlights from the Xamarin Evolve 2016 conference
Highlights from the Xamarin Evolve 2016 conference
 
Development Workshop on ET1, Android and Motorola RhoElements
Development Workshop on ET1, Android and Motorola RhoElementsDevelopment Workshop on ET1, Android and Motorola RhoElements
Development Workshop on ET1, Android and Motorola RhoElements
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applications
 
Mobile App Landscape for the Non-Technical
Mobile App Landscape for the Non-TechnicalMobile App Landscape for the Non-Technical
Mobile App Landscape for the Non-Technical
 
Post Windows Mobile: New Application Development Platforms
Post Windows Mobile: New Application Development PlatformsPost Windows Mobile: New Application Development Platforms
Post Windows Mobile: New Application Development Platforms
 

Mehr von SolTech, Inc.

Responsive Web Design using the Foundation 5 CSS Framework
Responsive Web Design using the Foundation 5 CSS FrameworkResponsive Web Design using the Foundation 5 CSS Framework
Responsive Web Design using the Foundation 5 CSS FrameworkSolTech, Inc.
 
How to Rock your Phone Interview: 4 Easy Steps
How to Rock your Phone Interview: 4 Easy StepsHow to Rock your Phone Interview: 4 Easy Steps
How to Rock your Phone Interview: 4 Easy StepsSolTech, Inc.
 
Empowering Your Job Search: 10 Tips
Empowering Your Job Search: 10 TipsEmpowering Your Job Search: 10 Tips
Empowering Your Job Search: 10 TipsSolTech, Inc.
 
Responsive Web Design using ZURB Foundation
Responsive Web Design using ZURB FoundationResponsive Web Design using ZURB Foundation
Responsive Web Design using ZURB FoundationSolTech, Inc.
 
Introduction to Dependency Injection
Introduction to Dependency InjectionIntroduction to Dependency Injection
Introduction to Dependency InjectionSolTech, Inc.
 
Debugging Javascript
Debugging JavascriptDebugging Javascript
Debugging JavascriptSolTech, Inc.
 
SolTech's The Constantly Connected Customer
SolTech's The Constantly Connected CustomerSolTech's The Constantly Connected Customer
SolTech's The Constantly Connected CustomerSolTech, Inc.
 

Mehr von SolTech, Inc. (8)

Responsive Web Design using the Foundation 5 CSS Framework
Responsive Web Design using the Foundation 5 CSS FrameworkResponsive Web Design using the Foundation 5 CSS Framework
Responsive Web Design using the Foundation 5 CSS Framework
 
How to Rock your Phone Interview: 4 Easy Steps
How to Rock your Phone Interview: 4 Easy StepsHow to Rock your Phone Interview: 4 Easy Steps
How to Rock your Phone Interview: 4 Easy Steps
 
Empowering Your Job Search: 10 Tips
Empowering Your Job Search: 10 TipsEmpowering Your Job Search: 10 Tips
Empowering Your Job Search: 10 Tips
 
Responsive Web Design using ZURB Foundation
Responsive Web Design using ZURB FoundationResponsive Web Design using ZURB Foundation
Responsive Web Design using ZURB Foundation
 
Introduction to Dependency Injection
Introduction to Dependency InjectionIntroduction to Dependency Injection
Introduction to Dependency Injection
 
Intro to AngularJs
Intro to AngularJsIntro to AngularJs
Intro to AngularJs
 
Debugging Javascript
Debugging JavascriptDebugging Javascript
Debugging Javascript
 
SolTech's The Constantly Connected Customer
SolTech's The Constantly Connected CustomerSolTech's The Constantly Connected Customer
SolTech's The Constantly Connected Customer
 

Kürzlich hochgeladen

Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfkalichargn70th171
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfFerryKemperman
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 

Kürzlich hochgeladen (20)

Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdfExploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
Exploring Selenium_Appium Frameworks for Seamless Integration with HeadSpin.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Introduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdfIntroduction Computer Science - Software Design.pdf
Introduction Computer Science - Software Design.pdf
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 

Getting started with Xamarin forms

  • 1. GETTING STARTED WITH XAMARIN FORMS Writing native mobile apps using our C# skills
  • 2. What is this Xamarin thing? • Brings the .NET Framework to mobile devices • Based upon Mono, an open source .NET runtime • Supports Android, iOS, Windows Phone, OSX • Supports the latest version of C# (5.0, including async/await) • Supports development in VS2012/13 but also includes their own IDE (Xamarin Studio) • Uses the native APIs/UI widgets • With every release of an API/OS level, the Xamarin team ensures that there’s a managed wrapper • Kept current (supported iOS8 on day 1, already includes Android L) • It’s a commercial product • Free (Starter) edition is very limited • 30-day trial available for testing/proof-of-concept work
  • 3. Why should I be interested in Xamarin? • Allows us to write in one language (C#) for all platforms • Android uses Java • iOS uses Objective C • Windows Phone uses C# • But wait: isn’t PhoneGap one language? • Most C# developers aren’t familiar enough with Javascript to write non-trivial apps • Javascript can be hard to debug (see: Chris’ talk) • WebView-hosted Javascript can be even harder to debug • Extensions (aka Plugins) must be written in the native languages • HTML is not a native UI Write once, run everywhere! (no, really!)
  • 4. Aha! But I still have to learn the platform’s UI! • Enter Xamarin Forms • Rather than requiring you to learn three different ways to express your UI, learn one: XAML • Reasonable level of component support (this *is* a 1.0…) • Uses a language we’re already reasonably familiar with (XML + syntax extensions) • Native API support means you still have access to the low-level UI components if/when you need them • Can compose new controls from sets of existing controls • Can modify the look/feel of existing controls • Can build entirely new controls with native Renderers • Can mix and match Forms and low-level in the same application
  • 5. DEMO: GETTING TO KNOW YOU Creating our first Visual Studio project
  • 6. Extensible Application Markup Language (XAML) • A way to express application UI layout in XML • Started out as a feature of WPF • Supports a high degree of composition • Turned out to be quite useful • Xamarin’s XAML dialect isn’t the same as WPF/Silverlight • It’s pretty similar; the learning curve is short if you’re already familiar with WPF/Silverlight • Doesn’t have the same feature set (e.g.: styles, behaviors not available yet) • Continually growing • http://developer.xamarin.com/guides/cross-platform/xamarin-forms/controls/views/
  • 7. DEMO: USING XAML FOR YOUR UI Creating a simple XAML form
  • 8. Binding • XAML supports data and command binding • This is huge! • Not every in-box control supports it, though  • Can specify one-way, two-way directional binding • Syntax is an extension of XML • <SomeControl SomeValue="{Binding PropertyName}"/> • Applies to properties and events (via commands) • Allows separation of Presentation and Behavior • Declare your UI completely in XAML • Have all logic live in code • This is different from code-behind!
  • 9. The Model-View-ViewModel (MVVM) Pattern • Model • Your data; typically objects retrieved from Web services, databases, etc. • Should contain just the state and any data validation code • View • Your presentation layer • Has no awareness of data classes; relies completely on binding for input/output/interaction • ViewModel • The “meat” of the application – contains interaction logic, fetch/save calls, any transformation from data-to-UI structures • Inherits INotifyPropertyChanged for property change notification to the view • Exposes ICommand properties for Command objects • Several prebuilt frameworks (MVVMLight, MVVMCross, etc.)
  • 10. DEMO: ADDING A VIEWMODEL Using a UI-independent object to manage state
  • 11. A Recipe for Successful MVVM • Use bindings for everything • The UI should be dumb as a post; have all logic in the ViewModel • Any code in the form’s codebehind should be UI-specific (layout, behaviors) • Have the ViewModel supply everything the view needs • No data fetching (e.g. drop-down lists) in the UI; expose a property from the VM • “Ready” pattern – bind IsVisible/IsEnabled to a “Ready” property • INotifyPropertyChanged • The ViewModel should either implement INotifyPropertyChanged or (even better) use a framework like MVVMLight & ViewModelBase • Whenever a property changes, fire PropertyChanged • Be careful when the model is complex; you may need to fire PropertyChanged for multiple properties from one change!
  • 12. Why should you take on the overhead of MVVM? • Supports multiple views with the same logic • Settings, user profile • Different layouts by orientation • Supports a designer/developer workflow • Designer works on layout/themes, developer works on logic • To be perfectly honest, we’re not quite there yet • Testing! • Code-behind means you can’t test logic without loading the UI • Unit tests of ViewModels can verify logic without having to know layout • You can use mock objects to simulate behaviors that are hard to duplicate when running the app (network failures, service errors, etc.)
  • 13. ViewModel + Unit Tests = BFF!!! • Efficient develop/test/debug cycle • You can now verify behavior without having to run the app and manually enter data • You can run a suite of tests with every build • Interfaces + Dependency Injection + Mocks • Allows you to get very far without needing an actual service • Edge-case/validation tests • Fault injection tests • Gives us a warm sense of security! • A lot less head-scratching if something fails at runtime • A much better indication of whether changes broke something
  • 14. DEMO: UNIT TESTING OUR VIEWMODEL Building a set of xUnit tests for our ViewModel
  • 15. Unit Testing Rules of Thumb • Design for Testability • Use interfaces for any services you use • Separate interfaces and data contracts from implementation • Use dependency injection to get references at runtime • Choose a portable framework • NUnit • XUnit • NOT MSTest • Unit test failures should break the build • Code coverage is nice, but there be dragons
  • 16. How can I get started? • Request a trial license from Xamarin • You may want to use a VM for this… • Business Edition required for Visual Studio support • $1000/platform (!) • Purchase an “Indie” license • $30/month (again, per platform) • Have to use Xamarin Studio • Publishing apps requires a bit more… • Apple Developer program is $100/yr. • Google Play registration is $25 (one-time)

Hinweis der Redaktion

  1. Create a Xamarin Forms (Portable) project Discuss project layout Launch under Android Player Discuss the need for a Mac for iOS development Launch under iPhone simulator
  2. Replace the generated ContentPage with a XAML form <StackLayout VerticalOptions=“Center”> <Label Text=“Hello, SolTech!”/> </StackLayout>
  3. Add a NuGet package reference to MVMVLight PCL (Libraries Only) Create a new ViewModelBase-derived class Add a Greeting property Set the VM as the Binding Context in App.cs Run Add a button to change the greeting with Command bound to UpdateGreetingCommand Add UpdateGreeting method Add UpdateGreetingCommand to VM Demo What happened? Why didn’t it update? RaisePropertyChanged Demo Add CanExecute to Command Demo
  4. Switch to full demo project Point out changes to XAML, ViewModel, show service