SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Getting Started with Caliburn.Micro
and Windows Phone 7
Gary Ewan Park
gep13@gep13.co.uk
Twitter: @gep13
Blog: http://www.gep13.co.uk/blog
Agenda
•
•
•
•
•
•
•
•
•

What is Caliburn.Micro?
Blank Project
Navigation Service
Guarding Actions
More Conventions and Navigation
Using a Custom Service
Application Life Cycle
Tombstoning
Launchers and Choosers
Source Code

http://gep13.me/CaliburnMicroDemos
My Development Rig…
Host Operating System:
• Windows 8
• Visual Studio 2012
• Office 2013 Home Premium Preview
Virtual Machine
• Windows 7
• Visual Studio 2010
• Windows Phone 7 SDK
• Local Git Repo for all code (using GitHub for Windows)
• Local Nuget Repo for Packages
What is MVVM?
The answer…
• Unfortunately, that is the topic of a whole other talk 
• During the talk, if there are any concepts that you want
covered, please feel free to ask, and I will do my best to
answer the question
• Have a look here for more info:
• http://gep13.me/MVVMPrimer
What is
Caliburn.Micro?
A Definition…
“Caliburn.Micro is a small, yet powerful framework, designed
for building applications across all Xaml Platforms. With strong
support for MVVM and other proven UI
patterns, Caliburn.Micro will enable you to build your solution
quickly, without the need to sacrifice code quality or
testability.”
Reference
 http://caliburnmicro.codeplex.com/
What does that mean?
• Caliburn.Micro is an Open Source Framework which helps
with the development of MVVM applications (as well as
other patterns)
• It supports:
• WPF 4.0
• Silverlight 4.0/5.0
• WP7
• WinRT (soon to be released)
• Ships as a Nuget package which can be easily added to
your Projects
• Strongly driven by Convention over Configuration
• Project is coordinated by Rob Eisenberg
(@EisenbergEffect)
Blank Project
Get into good habits…
• Caliburn.Micro has a number
of conventions, but it helps if
you get into good habits:
• Consistent Folder
Structure
• Suffix Views and
ViewModels
• Once you do, the
Caliburn.Micro magic starts
working for you 
Get started with Caliburn.Micro in 4(ish) steps
•
•
•
•
•

Install Nuget Package
Adopt consistent folder structure
Clear out App.xaml and App.xaml.cs
Update WMAppManifest.xml
Job done…

• Detailed steps can be found here:
http://gep13.me/CaliburnMicroDemo1
Demo 1

Blank Project
Using Caliburn.Micro on a New Project
Navigation Service
What is Caliburn.Micro doing for us?

AppBootstrapper

1

DI Container

4

MainPageViewModel

3
2

1.
2.
3.
4.
5.

ViewModelLocator

5

MainPageView.xaml

Register MainPageViewModel Type
Navigation to MainPageView.xaml
Retrieve MainPageViewModel
Create on Request
Assign MainPageViewModel as DataContext, optionally assign matching properties
from QueryString
Demo 2

Navigation Service
Navigating between ViewModels with ease
using the Navigation Service
Guarding Actions
Wait, I want to prevent an action happening…
• Any method, or navigation action, can be controlled (i.e.
disabled) based on a Convention of prefixing a method call
with Can…
Demo 3

Guarding Actions
Easily prevent/allow an action from occurring
using only properties in ViewModel
More Conventions
and Navigation
Apply Convention Binding to a ListBox
Assigning parameters to navigation Query String
• Support for strongly typed navigation
• Uses Fluent API to add information to resulting navigation
QueryString
• Full access to available ViewModel Properties
• Never mistype a Uri or mess up a query string
Demo 4

More Conventions and Navigation
Applying Conventions to more complicated
controls and passing variables between
ViewModels
Using a Custom
Service
DI Container For The Win…
• In addition to being able to provide ViewModels to the
ViewModelLocator, Caliburn.Micro’s DI Container can also
be used to provide other “services”
• There are built in services already available
• NavigationService
• EventAggregator
• PhoneService
• But there is nothing to stop you adding your own
• These “services” can be used, when required, on any
class, simply be adding them as a parameter into the
constructor of the class
You can chain lots of these services together…
Demo 5

Using a Custom Service
Use the Caliburn.Micro Dependency Injection
Container to provide services to ViewModel
Application Life
Cycle
The IPhoneService…
• No, nothing to do with the iPhone, sorry 
• Exposes application level events that make more sense
than the built in events
• Launching
• Activated
• Deactivated
• Closing
• Continuing
• Continued
• Resurrecting
• Resurrected
ViewModel Events
The following ViewModels events are exposed:
• OnViewAttached
• OnInitialize
• OnActivate
• OnViewReady
• OnViewLoaded
• OnDeactivate
Demo 6

Application Life Cycle
Tap into Application and ViewModel level
events
Tombstoning
Tombstoning in Caliburn.Micro
• Makes use of the events exposed in the IPhoneService to
reliably and accurately save/restore important data
• Extension methods provided for common user scenarios
• Possible to persist information in both Application State as
well as Phone State
• Possible to define at which point the information is restored
• Uses Fluent API to easily string user scenarios together
Demo 7

Tombstoning
Use Caliburn.Micro’s ability to Tombstone
individual properties of a ViewModel into
Application and Phone State
Launchers and
Choosers
Launchers and Choosers
• Launchers and Choosers are painful to work with if you
want to do MVVM, not in Caliburn.Micro.
• Built on top of the IEventAggregator
• Using the IHandle interface, possible to return a
TaskCompleted Generic which matches the
Launcher/Chooser that you are using
• Simple Subscribe/Unsubscribe model
Demo 8

Launchers and Choosers
Easily use Windows Phone 7 Launchers and
Choosers in an MVVM pattern
The Future…
Does Caliburn.Micro support Windows Phone 8?
The answer is yes 
Check here for more information:
http://gep13.me/CMonWP8
Useful Links
• An Introduction
• http://www.codeproject.com/Articles/175610/Calibur
n-Micro-for-Windows-Phone-7
• Project Home Page
• http://caliburnmicro.codeplex.com/
• Work in Progress Sample Application
• https://github.com/gep13/VBForums-Viewer
Questions?

Feel free to email me any additional
questions at
gep13@gep13.co.uk

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (6)

Meteor presentation
Meteor presentationMeteor presentation
Meteor presentation
 
Understanding Microservices
Understanding Microservices Understanding Microservices
Understanding Microservices
 
Chatbots
ChatbotsChatbots
Chatbots
 
Building Chatbots
Building ChatbotsBuilding Chatbots
Building Chatbots
 
Speeding Up WooCommerce
Speeding Up WooCommerceSpeeding Up WooCommerce
Speeding Up WooCommerce
 
WordPress and IoT
WordPress and IoTWordPress and IoT
WordPress and IoT
 

Ähnlich wie Getting started with caliburn.micro and windows phone 7

Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality
 Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality
Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to realityDaniel Gallego Vico
 
Mobile Application Testing Training Presentation
Mobile Application Testing Training PresentationMobile Application Testing Training Presentation
Mobile Application Testing Training PresentationMobiGnosis
 
DSC Cloud Study Jams
DSC Cloud Study JamsDSC Cloud Study Jams
DSC Cloud Study JamsKateGrupp
 
Uncovering breaking changes behind UI on mobile applications
Uncovering breaking changes behind UI on mobile applicationsUncovering breaking changes behind UI on mobile applications
Uncovering breaking changes behind UI on mobile applicationsKazuaki Matsuo
 
Real World Windows Phone Development
Real World Windows Phone DevelopmentReal World Windows Phone Development
Real World Windows Phone DevelopmentIgor Kulman
 
Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Niels Frydenholm
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Gil Irizarry
 
Infinum android talks_10_android_libraries_used_on_daily_basis
Infinum android talks_10_android_libraries_used_on_daily_basisInfinum android talks_10_android_libraries_used_on_daily_basis
Infinum android talks_10_android_libraries_used_on_daily_basisInfinum
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
Overview of DroidCon UK 2015
Overview of DroidCon UK 2015 Overview of DroidCon UK 2015
Overview of DroidCon UK 2015 Elif Boncuk
 
Mobile Devices
Mobile DevicesMobile Devices
Mobile DevicesYnon Perek
 
Building mobile apps with PhoneGap and Backbone
Building mobile apps with PhoneGap and BackboneBuilding mobile apps with PhoneGap and Backbone
Building mobile apps with PhoneGap and BackboneTroy Miles
 
Being Epic: Best Practices for Android Development
Being Epic: Best Practices for Android DevelopmentBeing Epic: Best Practices for Android Development
Being Epic: Best Practices for Android DevelopmentReto Meier
 
10 tips for Cloud Native Security
10 tips for Cloud Native Security10 tips for Cloud Native Security
10 tips for Cloud Native SecurityKarthik Gaekwad
 
4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)
4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)
4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)PROIDEA
 

Ähnlich wie Getting started with caliburn.micro and windows phone 7 (20)

Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality
 Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality
Droidcon Spain 2016 - The Pragmatic Android Programmer: from hype to reality
 
Mobile Application Testing Training Presentation
Mobile Application Testing Training PresentationMobile Application Testing Training Presentation
Mobile Application Testing Training Presentation
 
DSC Cloud Study Jams
DSC Cloud Study JamsDSC Cloud Study Jams
DSC Cloud Study Jams
 
Uncovering breaking changes behind UI on mobile applications
Uncovering breaking changes behind UI on mobile applicationsUncovering breaking changes behind UI on mobile applications
Uncovering breaking changes behind UI on mobile applications
 
Webinar : Microservices and Containerization
Webinar : Microservices and ContainerizationWebinar : Microservices and Containerization
Webinar : Microservices and Containerization
 
Real World Windows Phone Development
Real World Windows Phone DevelopmentReal World Windows Phone Development
Real World Windows Phone Development
 
Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...Getting your mobile test automation process in place - using Cucumber and Cal...
Getting your mobile test automation process in place - using Cucumber and Cal...
 
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
Make Cross-platform Mobile Apps Quickly - SIGGRAPH 2014
 
Infinum android talks_10_android_libraries_used_on_daily_basis
Infinum android talks_10_android_libraries_used_on_daily_basisInfinum android talks_10_android_libraries_used_on_daily_basis
Infinum android talks_10_android_libraries_used_on_daily_basis
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
Overview of DroidCon UK 2015
Overview of DroidCon UK 2015 Overview of DroidCon UK 2015
Overview of DroidCon UK 2015
 
Mobile Devices
Mobile DevicesMobile Devices
Mobile Devices
 
Building mobile apps with PhoneGap and Backbone
Building mobile apps with PhoneGap and BackboneBuilding mobile apps with PhoneGap and Backbone
Building mobile apps with PhoneGap and Backbone
 
ColdFusion 11 New Features
ColdFusion 11 New FeaturesColdFusion 11 New Features
ColdFusion 11 New Features
 
Being Epic: Best Practices for Android Development
Being Epic: Best Practices for Android DevelopmentBeing Epic: Best Practices for Android Development
Being Epic: Best Practices for Android Development
 
IBM MobileFirst Platform v7.0 Pot Intro v0.1
IBM MobileFirst Platform v7.0 Pot Intro v0.1IBM MobileFirst Platform v7.0 Pot Intro v0.1
IBM MobileFirst Platform v7.0 Pot Intro v0.1
 
IBM MobileFirst Platform v7.0 pot intro v0.1
IBM MobileFirst Platform v7.0 pot intro v0.1IBM MobileFirst Platform v7.0 pot intro v0.1
IBM MobileFirst Platform v7.0 pot intro v0.1
 
10 tips for Cloud Native Security
10 tips for Cloud Native Security10 tips for Cloud Native Security
10 tips for Cloud Native Security
 
Deep Inside Android Hacks
Deep Inside Android HacksDeep Inside Android Hacks
Deep Inside Android Hacks
 
4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)
4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)
4Developers 2018: Zero-Downtime deployments with Kubernetes (Mateusz Dymiński)
 

Mehr von Gary Park

A Piece of Cake - DDD North
A Piece of Cake - DDD NorthA Piece of Cake - DDD North
A Piece of Cake - DDD NorthGary Park
 
A Piece of Cake - DDD11 - Reading
A Piece of Cake - DDD11 - ReadingA Piece of Cake - DDD11 - Reading
A Piece of Cake - DDD11 - ReadingGary Park
 
A Piece of Cake - NDC Oslo 2016
A Piece of Cake - NDC Oslo 2016A Piece of Cake - NDC Oslo 2016
A Piece of Cake - NDC Oslo 2016Gary Park
 
Having your cake, and eating it too! - DDDScotland
Having your cake, and eating it too! - DDDScotlandHaving your cake, and eating it too! - DDDScotland
Having your cake, and eating it too! - DDDScotlandGary Park
 
Having your cake, and eating it too!
Having your cake, and eating it too!Having your cake, and eating it too!
Having your cake, and eating it too!Gary Park
 
Semantic Versioning with GitVersion - Take 2
Semantic Versioning with GitVersion - Take 2Semantic Versioning with GitVersion - Take 2
Semantic Versioning with GitVersion - Take 2Gary Park
 
Semantic Versioning with GitVersion
Semantic Versioning with GitVersionSemantic Versioning with GitVersion
Semantic Versioning with GitVersionGary Park
 
StyleCop breaking down the barriers to entry
StyleCop breaking down the barriers to entryStyleCop breaking down the barriers to entry
StyleCop breaking down the barriers to entryGary Park
 
Mmmm, chocolatey goodness!
Mmmm, chocolatey goodness!Mmmm, chocolatey goodness!
Mmmm, chocolatey goodness!Gary Park
 
Continuous integration 101
Continuous integration 101Continuous integration 101
Continuous integration 101Gary Park
 

Mehr von Gary Park (10)

A Piece of Cake - DDD North
A Piece of Cake - DDD NorthA Piece of Cake - DDD North
A Piece of Cake - DDD North
 
A Piece of Cake - DDD11 - Reading
A Piece of Cake - DDD11 - ReadingA Piece of Cake - DDD11 - Reading
A Piece of Cake - DDD11 - Reading
 
A Piece of Cake - NDC Oslo 2016
A Piece of Cake - NDC Oslo 2016A Piece of Cake - NDC Oslo 2016
A Piece of Cake - NDC Oslo 2016
 
Having your cake, and eating it too! - DDDScotland
Having your cake, and eating it too! - DDDScotlandHaving your cake, and eating it too! - DDDScotland
Having your cake, and eating it too! - DDDScotland
 
Having your cake, and eating it too!
Having your cake, and eating it too!Having your cake, and eating it too!
Having your cake, and eating it too!
 
Semantic Versioning with GitVersion - Take 2
Semantic Versioning with GitVersion - Take 2Semantic Versioning with GitVersion - Take 2
Semantic Versioning with GitVersion - Take 2
 
Semantic Versioning with GitVersion
Semantic Versioning with GitVersionSemantic Versioning with GitVersion
Semantic Versioning with GitVersion
 
StyleCop breaking down the barriers to entry
StyleCop breaking down the barriers to entryStyleCop breaking down the barriers to entry
StyleCop breaking down the barriers to entry
 
Mmmm, chocolatey goodness!
Mmmm, chocolatey goodness!Mmmm, chocolatey goodness!
Mmmm, chocolatey goodness!
 
Continuous integration 101
Continuous integration 101Continuous integration 101
Continuous integration 101
 

Kürzlich hochgeladen

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 

Kürzlich hochgeladen (20)

Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 

Getting started with caliburn.micro and windows phone 7

  • 1. Getting Started with Caliburn.Micro and Windows Phone 7 Gary Ewan Park gep13@gep13.co.uk Twitter: @gep13 Blog: http://www.gep13.co.uk/blog
  • 2. Agenda • • • • • • • • • What is Caliburn.Micro? Blank Project Navigation Service Guarding Actions More Conventions and Navigation Using a Custom Service Application Life Cycle Tombstoning Launchers and Choosers
  • 4. My Development Rig… Host Operating System: • Windows 8 • Visual Studio 2012 • Office 2013 Home Premium Preview Virtual Machine • Windows 7 • Visual Studio 2010 • Windows Phone 7 SDK • Local Git Repo for all code (using GitHub for Windows) • Local Nuget Repo for Packages
  • 6. The answer… • Unfortunately, that is the topic of a whole other talk  • During the talk, if there are any concepts that you want covered, please feel free to ask, and I will do my best to answer the question • Have a look here for more info: • http://gep13.me/MVVMPrimer
  • 8. A Definition… “Caliburn.Micro is a small, yet powerful framework, designed for building applications across all Xaml Platforms. With strong support for MVVM and other proven UI patterns, Caliburn.Micro will enable you to build your solution quickly, without the need to sacrifice code quality or testability.” Reference  http://caliburnmicro.codeplex.com/
  • 9. What does that mean? • Caliburn.Micro is an Open Source Framework which helps with the development of MVVM applications (as well as other patterns) • It supports: • WPF 4.0 • Silverlight 4.0/5.0 • WP7 • WinRT (soon to be released) • Ships as a Nuget package which can be easily added to your Projects • Strongly driven by Convention over Configuration • Project is coordinated by Rob Eisenberg (@EisenbergEffect)
  • 11. Get into good habits… • Caliburn.Micro has a number of conventions, but it helps if you get into good habits: • Consistent Folder Structure • Suffix Views and ViewModels • Once you do, the Caliburn.Micro magic starts working for you 
  • 12. Get started with Caliburn.Micro in 4(ish) steps • • • • • Install Nuget Package Adopt consistent folder structure Clear out App.xaml and App.xaml.cs Update WMAppManifest.xml Job done… • Detailed steps can be found here: http://gep13.me/CaliburnMicroDemo1
  • 13. Demo 1 Blank Project Using Caliburn.Micro on a New Project
  • 15. What is Caliburn.Micro doing for us? AppBootstrapper 1 DI Container 4 MainPageViewModel 3 2 1. 2. 3. 4. 5. ViewModelLocator 5 MainPageView.xaml Register MainPageViewModel Type Navigation to MainPageView.xaml Retrieve MainPageViewModel Create on Request Assign MainPageViewModel as DataContext, optionally assign matching properties from QueryString
  • 16. Demo 2 Navigation Service Navigating between ViewModels with ease using the Navigation Service
  • 18. Wait, I want to prevent an action happening… • Any method, or navigation action, can be controlled (i.e. disabled) based on a Convention of prefixing a method call with Can…
  • 19. Demo 3 Guarding Actions Easily prevent/allow an action from occurring using only properties in ViewModel
  • 21. Apply Convention Binding to a ListBox
  • 22. Assigning parameters to navigation Query String • Support for strongly typed navigation • Uses Fluent API to add information to resulting navigation QueryString • Full access to available ViewModel Properties • Never mistype a Uri or mess up a query string
  • 23. Demo 4 More Conventions and Navigation Applying Conventions to more complicated controls and passing variables between ViewModels
  • 25. DI Container For The Win… • In addition to being able to provide ViewModels to the ViewModelLocator, Caliburn.Micro’s DI Container can also be used to provide other “services” • There are built in services already available • NavigationService • EventAggregator • PhoneService • But there is nothing to stop you adding your own • These “services” can be used, when required, on any class, simply be adding them as a parameter into the constructor of the class
  • 26. You can chain lots of these services together…
  • 27. Demo 5 Using a Custom Service Use the Caliburn.Micro Dependency Injection Container to provide services to ViewModel
  • 29. The IPhoneService… • No, nothing to do with the iPhone, sorry  • Exposes application level events that make more sense than the built in events • Launching • Activated • Deactivated • Closing • Continuing • Continued • Resurrecting • Resurrected
  • 30. ViewModel Events The following ViewModels events are exposed: • OnViewAttached • OnInitialize • OnActivate • OnViewReady • OnViewLoaded • OnDeactivate
  • 31. Demo 6 Application Life Cycle Tap into Application and ViewModel level events
  • 33. Tombstoning in Caliburn.Micro • Makes use of the events exposed in the IPhoneService to reliably and accurately save/restore important data • Extension methods provided for common user scenarios • Possible to persist information in both Application State as well as Phone State • Possible to define at which point the information is restored • Uses Fluent API to easily string user scenarios together
  • 34. Demo 7 Tombstoning Use Caliburn.Micro’s ability to Tombstone individual properties of a ViewModel into Application and Phone State
  • 36. Launchers and Choosers • Launchers and Choosers are painful to work with if you want to do MVVM, not in Caliburn.Micro. • Built on top of the IEventAggregator • Using the IHandle interface, possible to return a TaskCompleted Generic which matches the Launcher/Chooser that you are using • Simple Subscribe/Unsubscribe model
  • 37. Demo 8 Launchers and Choosers Easily use Windows Phone 7 Launchers and Choosers in an MVVM pattern
  • 38. The Future… Does Caliburn.Micro support Windows Phone 8? The answer is yes  Check here for more information: http://gep13.me/CMonWP8
  • 39. Useful Links • An Introduction • http://www.codeproject.com/Articles/175610/Calibur n-Micro-for-Windows-Phone-7 • Project Home Page • http://caliburnmicro.codeplex.com/ • Work in Progress Sample Application • https://github.com/gep13/VBForums-Viewer
  • 40. Questions? Feel free to email me any additional questions at gep13@gep13.co.uk

Hinweis der Redaktion

  1. Questions – feel free to ask them at any point, just throw up your hand, or if I don’t see you, feel free to shout at me.
  2. How many people are using MVVM?If you have any questions about what I am doing at any point, feel free to ask.
  3. This is the question that we are trying to answer today.
  4. Ask who is currently using Caliburn.Micro
  5. How is Caliburn.Micro going to help you on a day to day basis? That is what we are trying to answer here.
  6. When Navigating To a PageUse the new ViewModelLocator to conventionally determine the Type of the VM that should be attached to the page being navigated to. Pull that VM by Type out of the container.If a VM is found, use the ViewModelBinder to connect the Page to the located ViewModel.Examine the Page’s QueryString. Look for properties on the VM that match the QueryString parameters and inject them, performing the necessary type coercion.If the ViewModel implements the IActivate interface, call its Activate method.When Navigating Away From a PageDetect whether the associated ViewModel implements the IGuardClose interface.If IGuardClose is implemented and the app is not being tombstoned or closed, invoke the CanClose method and use its result to optionally cancel page navigation.1If the ViewModel can close and implements the IDeactivate interface, call it’s Deactivate method. Always pass “false” to indicate that the VM should deactivate, but not necessarily close. This is because the phone may be deactivating, but not actually tombstoning or closing. There’s no way to know.
  7. C:\Program Files (x86)\MSBuild\Microsoft\StyleCop\v4.4
  8. Launching – occurs when a fresh instance of the application is launchingActivated – Occurs when a previously paused/tombstoned app is resumed/resurrectedDeactivated – Occurs when the application is being paused or tombstonedClosing – Occurs when the application is closingContinuing – Occurs when the app is continuing from a temporarily paused stateContinued – Occurs after the app has continued from a temporarily paused stateResurrecting – Occurs when the app is “resurrecting” from a tombstoned stateResurrected – Occurs after the app has “resurrected” from a tombstoned state