SESSION CODE: WPH301

  AlphaJax - Building a cloud-
  connected game for WP7 using
  Silverlight & Caliburn Micro
  MVVM ...
AlphaJax – WP7, Silverlight and Caliburn Micro
The next 60 minutes….
1.   App Overview and Demo (15 mins)
2.   Architectur...
www.alphajax.com
      @alphajax




4
AlphaJax –Architectural Overview
                                           Microsoft
                                    ...
AlphaJax –Architectural Overview - Solution




6
AlphaJax – Deep Dive
Creating a new Game
You can create games in 4 ways….
    Choose an email contact on the phone
    Ent...
AlphaJax - Creating a New Game – The View




 8
AlphaJax -
    Creating a
    New Game -
    The View CB




9
AlphaJax - Creating a New Game -View Model 1




10
AlphaJax - Creating a New Game -View Model 2




11
AlphaJax – Introducing Caliburn Micro
     A WP7 framework which….
       Wires VModels to Views via Convention (no code r...
AlphaJax – Caliburn Micro – Setting Up

1. Reference Caliburn.Micro.dll
   (http://caliburnmicro.codeplex.com/)
2. Add IoC...
AlphaJax – Caliburn Micro - Bootstrapper




14
AlphaJax – Caliburn Micro – App.xaml.cs




15
AlphaJax – Caliburn Micro – [SurviveTombstone]




16
AlphaJax – Isolated Storage

     There are apis for persisting state
     For example, game state, application settings, ...
AlphaJax – Isolated Storage Worker – Get/Save




18
AlphaJax – Isolated Storage Worker – Deletion




19
AlphaJax – Deep Dive - Creating a New Game
The Web Service – GameService.svc.cs
     Use REST, not SOAP.
     Use JSON, no...
AlphaJax – Deep Dive - Web Service
Web.Config – Step 1 of 3




21
AlphaJax – Deep Dive - Web Service
GameService.svc – Step 2 of 3




22
AlphaJax – Deep Dive - Web Service
GameService.svc.cs – Step 3 of 3




23
AlphaJax – Deep Dive - Creating a New Game
The Web Service – REST Attributes




24
AlphaJax – Deep Dive - Creating a New Game
The Web Service – WCF REST Help Page




25
AlphaJax – Deep Dive - WCF Client Helper
The Web Service – WCF Rest Client




26
AlphaJax – Deep Dive - Creating a New Game
Business Layer – Entity Framework
     Entity Framework and SQL 2008 Server as ...
AlphaJax – Deep Dive - DTO Example

                        Keep your data contracts
                        as simple and...
AlphaJax – Deep Dive - EF Profiler




29
AlphaJax
Testing it all with SL Unit Testing Framework
     4 public methods on CreateViewModel
        CreateByUsername –...
AlphaJax – Unit Testing – Async Test Example




31
AlphaJax – Unit Testing – Async Timeout

                              You should use this
                              a...
AlphaJax
Hosting
     Currently using www.gogrid.com cloud hosting
     GoGrid supports easy creation of a ‘Gold VM’ which...
AlphaJax
SL Unit Testing Framework Links
     Get the SL Unit Testing Framework for WP7:
     http://www.jeff.wilcox.name/...
AlphaJax
Caliburn Micro Resources

     Caliburn Micro WP7 blog post:
     http://devlicio.us/blogs/rob_eisenberg/archive/...
AlphaJax
Other Info And Links
     Follow me @kpatton
     Follow @alphajax
     My company www.markerstudio.com
     Sign...
Related Content
     WPH303 Triskaidekaphobia? 5.25pm in the Elliot Room, i.e. NOW!


     WPH401 From Phone Zero to Phone...
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be...
AlphaJax = Building a cloud-connected game for Windows Phone 7 using Silverlight and Caliburn Micro Framework
Upcoming SlideShare
Loading in …5
×

AlphaJax = Building a cloud-connected game for Windows Phone 7 using Silverlight and Caliburn Micro Framework

1,634 views

Published on

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

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,634
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
15
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

AlphaJax = Building a cloud-connected game for Windows Phone 7 using Silverlight and Caliburn Micro Framework

  1. 1. 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
  2. 2. 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
  3. 3. www.alphajax.com @alphajax 4
  4. 4. AlphaJax –Architectural Overview Microsoft Push Notifications Views (UI) Caliburn Micro (Fairy Dust) WCF Rest/Json (Web Services) View Models (Data Context) Service Agents Entity Framework Local Model 5
  5. 5. AlphaJax –Architectural Overview - Solution 6
  6. 6. 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
  7. 7. AlphaJax - Creating a New Game – The View 8
  8. 8. AlphaJax - Creating a New Game - The View CB 9
  9. 9. AlphaJax - Creating a New Game -View Model 1 10
  10. 10. AlphaJax - Creating a New Game -View Model 2 11
  11. 11. 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
  12. 12. 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
  13. 13. AlphaJax – Caliburn Micro - Bootstrapper 14
  14. 14. AlphaJax – Caliburn Micro – App.xaml.cs 15
  15. 15. AlphaJax – Caliburn Micro – [SurviveTombstone] 16
  16. 16. 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
  17. 17. AlphaJax – Isolated Storage Worker – Get/Save 18
  18. 18. AlphaJax – Isolated Storage Worker – Deletion 19
  19. 19. 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
  20. 20. AlphaJax – Deep Dive - Web Service Web.Config – Step 1 of 3 21
  21. 21. AlphaJax – Deep Dive - Web Service GameService.svc – Step 2 of 3 22
  22. 22. AlphaJax – Deep Dive - Web Service GameService.svc.cs – Step 3 of 3 23
  23. 23. AlphaJax – Deep Dive - Creating a New Game The Web Service – REST Attributes 24
  24. 24. AlphaJax – Deep Dive - Creating a New Game The Web Service – WCF REST Help Page 25
  25. 25. AlphaJax – Deep Dive - WCF Client Helper The Web Service – WCF Rest Client 26
  26. 26. 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
  27. 27. 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
  28. 28. AlphaJax – Deep Dive - EF Profiler 29
  29. 29. 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
  30. 30. AlphaJax – Unit Testing – Async Test Example 31
  31. 31. 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
  32. 32. 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
  33. 33. 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
  34. 34. 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
  35. 35. 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
  36. 36. 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
  37. 37. © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

×