The warts and all journey from Mix to (almost) launch of a complete application.
See working demos of the game in action and learn how to structure your WP7 solutions and gain insight into key APIs and related patterns and technologies such as Isolated Storage, Caliburn Micro Framework, the Silverlight Unit Testing Framework and WCF Rest services.
Accompanies the Tech Ed New Zealand 2010 talk here:
http://www.msteched.com/2010/NewZealand/WPH301
AlphaJax = Building a cloud-connected game for Windows Phone 7 using Silverlight and Caliburn Micro Framework
1.
2. SESSION CODE: WPH301
AlphaJax - Building a cloud-
connected game for WP7 using
Silverlight & Caliburn Micro
MVVM Light
Keith Patton - @kpatton
Development Manager
www.markerstudio.com
3. AlphaJax – WP7, Silverlight and Caliburn Micro
The next 60 minutes….
1. App Overview and Demo (15 mins)
2. Architectural Overview (5 mins)
3. Deep Dive - Creating a New Game (30 mins)
4. Testing with Silverlight Unit Testing Framework (10 mins)
3
7. AlphaJax – Deep Dive
Creating a new Game
You can create games in 4 ways….
Choose an email contact on the phone
Enter the AlphaJax username of a friend
Choose a random opponent
Choose a top opponent played before
7
12. AlphaJax – Introducing Caliburn Micro
A WP7 framework which….
Wires VModels to Views via Convention (no code required)
Wires View Events to VModels via Convention (e.g. Button Clicks)
Simple IoC Container to allow VM Dependency Injection
Provides VM lifecycle management capabilities
55KB!
12
13. AlphaJax – Caliburn Micro – Setting Up
1. Reference Caliburn.Micro.dll
(http://caliburnmicro.codeplex.com/)
2. Add IoC container classes (code provided)
3. Add a Bootstrapper class and add VModels
4. Reference Bootstrapper in App.xaml
13
17. AlphaJax – Isolated Storage
There are apis for persisting state
For example, game state, application settings, anything
you want to persist across app restarts
There are no limits as such, but be sensible
17
20. AlphaJax – Deep Dive - Creating a New Game
The Web Service – GameService.svc.cs
Use REST, not SOAP.
Use JSON, not XML.
Isn’t WCF Config a Nightmare?
20
21. AlphaJax – Deep Dive - Web Service
Web.Config – Step 1 of 3
21
22. AlphaJax – Deep Dive - Web Service
GameService.svc – Step 2 of 3
22
23. AlphaJax – Deep Dive - Web Service
GameService.svc.cs – Step 3 of 3
23
24. AlphaJax – Deep Dive - Creating a New Game
The Web Service – REST Attributes
24
25. AlphaJax – Deep Dive - Creating a New Game
The Web Service – WCF REST Help Page
25
26. AlphaJax – Deep Dive - WCF Client Helper
The Web Service – WCF Rest Client
26
27. AlphaJax – Deep Dive - Creating a New Game
Business Layer – Entity Framework
Entity Framework and SQL 2008 Server as back end
EF Profiler for performance analysis.
(www.efprof.com)
Do NOT serialize your entities directly!
27
28. AlphaJax – Deep Dive - DTO Example
Keep your data contracts
as simple and small as
possible.
Do not expose your
entities across the wire
Use scalar values
wherever possible
28
30. AlphaJax
Testing it all with SL Unit Testing Framework
4 public methods on CreateViewModel
CreateByUsername – via button click
CreateByEmail – via email chooser task
CreateByRandom – via button click
CreateBySelectedTopOpponent – via listbox
Caliburn gives us maximum testability
Demo of the SL Unit Testing App
30
32. AlphaJax – Unit Testing – Async Timeout
You should use this
approach to ensure
that your tests don’t
time out if the
callback never fires!
32
33. AlphaJax
Hosting
Currently using www.gogrid.com cloud hosting
GoGrid supports easy creation of a ‘Gold VM’ which you
can instantiate out in < 20 minutes.
F5 Load Balancer for free
Pay for what you use or pay monthly for ‘RAM hours’
SQL Server discounts for Bizspark partners
Pondering Azure….
33
34. AlphaJax
SL Unit Testing Framework Links
Get the SL Unit Testing Framework for WP7:
http://www.jeff.wilcox.name/2010/05/sl3-utf-bits/
Unit Testing Walkthrough Blog Post:
http://www.markerstudio.com/technical/2010/07/mvvm-
light-and-unit-testing-example/
34
35. AlphaJax
Caliburn Micro Resources
Caliburn Micro WP7 blog post:
http://devlicio.us/blogs/rob_eisenberg/archive/2010/08/07/caliburn-micro-soup-to-nuts-pt-4-working-with-
windows-phone-7.aspx
Simple Container IoC used by Caliburn Micro
http://simplecontainer.codeplex.com/
More on WCF Rest
http://msdn.microsoft.com/en-us/netframework/cc950529.aspx
35
36. AlphaJax
Other Info And Links
Follow me @kpatton
Follow @alphajax
My company www.markerstudio.com
Sign up at AlphaJax www.alphajax.com
Sell your apps!
http://developer.windowsphone.com
36
37. Related Content
WPH303 Triskaidekaphobia? 5.25pm in the Elliot Room, i.e. NOW!
WPH401 From Phone Zero to Phone Hero in 60 minutes
Chris Auld and Chris Klug in Theatre
Wed 1st September 2.55pm
Thank You!
37