You are previewing Professional Windows® Phone 7 Application Development: Building Applications and Games Using Visual Studio, Silverlight®, and XNA®.
O'Reilly logo
Professional Windows® Phone 7 Application Development: Building Applications and Games Using Visual Studio, Silverlight®, and XNA®

Book Description

A one-of-a-kind book on Windows Phone 7 development

While numerous books cover both Silverlight and XNA, there lacks a resource that covers the specifics of Windows Phone 7 development. This book fills that void and shares the specifics of building phone applications and games. You'll learn how to get started with designing, building, testing, and deploying mobile applications for Windows Phone 7. Working examples used throughout the book cover how to design and layout a Windows Phone 7 application, interact with the device, and even sell your applications.

  • Fills the void in the market for an instructional book on developing applications for Windows Phone 7

  • Offers an overview of Windows Phone and discusses the necessary tools

  • Explains how to work with multiview applications

  • Addresses tool bars, pickers, table views, navigation controllers, application setting, and user defaults

  • Reviews drawing with XNA, using the camera, and understanding basic data persistence

Explore the exciting possibilties of Windows Phone 7 development with this invaluable reference.

Table of Contents

  1. Copyright
  2. ABOUT THE AUTHORS
  3. ABOUT THE TECHNICAL EDITOR
  4. CREDITS
  5. ACKNOWLEDGMENTS
  6. INTRODUCTION
    1. WHO THIS BOOK IS FOR
    2. WHAT THIS BOOK COVERS
    3. HOW THIS BOOK IS STRUCTURED
    4. WHAT YOU NEED TO USE THIS BOOK
    5. CONVENTIONS
    6. SOURCE CODE
    7. ERRATA
    8. P2P.WROX.COM
  7. 1. Taking the Metro with Windows Phone
    1. 1.1. MINIMUM SPECIFICATIONS
      1. 1.1.1. Chassis Design
      2. 1.1.2. Screen Resolution
    2. 1.2. METRO DESIGN LANGUAGE
      1. 1.2.1. Principles
      2. 1.2.2. User Experience
    3. 1.3. START AND LOCK SCREENS
    4. 1.4. HUBS
    5. 1.5. DEVELOPER LANDSCAPE
    6. 1.6. SUMMARY
  8. 2. Free Transport with Visual Studio 2010 and Expression Blend 4
    1. 2.1. VISUAL STUDIO 2010 EXPRESS FOR WINDOWS PHONE
    2. 2.2. EXPRESSION BLEND 4
    3. 2.3. WINDOWS PHONE EMULATOR
    4. 2.4. SUMMARY
  9. 3. Designing Layouts Using Red Threads
    1. 3.1. RED THREADS
    2. 3.2. CONTROLS
      1. 3.2.1. Standard Controls
        1. 3.2.1.1. ContentProperty
        2. 3.2.1.2. TextBlock, Run, and LineBreak
        3. 3.2.1.3. Image, MediaElement, and ProgressBar
        4. 3.2.1.4. Ellipse, Rectangle, and Path
        5. 3.2.1.5. WebBrowser
    3. 3.3. LAYOUT
    4. 3.4. RESOURCES AND STYLES
      1. 3.4.1.
        1. 3.4.1.1. Control Templates
    5. 3.5. THEMES
    6. 3.6. SUMMARY
  10. 4. Adding Motion
    1. 4.1. VISUAL STATE MANAGEMENT
    2. 4.2. BEHAVIORS
    3. 4.3. ANIMATION
      1. 4.3.1. Template Transitions
      2. 4.3.2. State Transitions
    4. 4.4. PANORAMIC AND PIVOT CONTROLS
    5. 4.5. SUMMARY
  11. 5. Orientation and Overlays
    1. 5.1. DEVICE ORIENTATION
      1. 5.1.1. Orientation Detection
      2. 5.1.2. Orientation Changes
      3. 5.1.3. Orientation Strategies
        1. 5.1.3.1. Fixed Orientation
        2. 5.1.3.2. Auto-Layout
        3. 5.1.3.3. Manual Intervention
        4. 5.1.3.4. Changing States
        5. 5.1.3.5. Smooth Transitions
    2. 5.2. SOFT INPUT PANEL (SIP)
    3. 5.3. APPLICATION BAR
      1. 5.3.1. Icon Buttons
        1. 5.3.1.1. Icon Library
        2. 5.3.1.2. Adding an Icon
      2. 5.3.2. Menu Items
      3. 5.3.3. Opacity
      4. 5.3.4. StateChanged Event
    4. 5.4. SYSTEM TRAY
    5. 5.5. SUMMARY
  12. 6. Navigation
    1. 6.1. PAGE LAYOUT AND ARCHITECTURE
    2. 6.2. NAVIGATION
      1. 6.2.1. Fragments and QueryString
      2. 6.2.2. UriMapping
      3. 6.2.3. Go Back
      4. 6.2.4. GoBack and CanGoBack
      5. 6.2.5. Animation
        1. 6.2.5.1. Hiding the Current Page
        2. 6.2.5.2. Displaying the New Page
        3. 6.2.5.3. Animation Storyboards
      6. 6.2.6. Wizards
    3. 6.3. BACKGROUND PROCESSING
      1. 6.3.1. Eligible for Termination
      2. 6.3.2. Scenarios
        1. 6.3.2.1. Application Launched From Start
          1. 6.3.2.1.1. Second Launch
          2. 6.3.2.1.2. Back: No Tombstone
          3. 6.3.2.1.3. Back: Tombstoned
        2. 6.3.2.2. Two Applications
      3. 6.3.3. Saving State
        1. 6.3.3.1. Page State
        2. 6.3.3.2. Application State
      4. 6.3.4. Obscured
        1. 6.3.4.1. Lock Screen
    4. 6.4. SUMMARY
  13. 7. Application Tiles and Notification
    1. 7.1. APPLICATION TILE
    2. 7.2. PUSH NOTIFICATIONS
      1. 7.2.1. Priority
      2. 7.2.2. Tile Notifications
      3. 7.2.3. Toast Notifications
      4. 7.2.4. Raw Notifications
      5. 7.2.5. Examples
        1. 7.2.5.1. Tile Notification
        2. 7.2.5.2. Toast Notification
        3. 7.2.5.3. Raw Notification
        4. 7.2.5.4. Long Running Web Service
      6. 7.2.6. Errors
    3. 7.3. SUMMARY
  14. 8. Tasks
    1. 8.1. WINDOWS PHONE TASKS
      1. 8.1.1. Where Did My Application Go?
      2. 8.1.2. Camera and Photos
        1. 8.1.2.1. CameraCaptureTask
        2. 8.1.2.2. PhotoChooserTask
      3. 8.1.3. Phone and SMS
        1. 8.1.3.1. SavePhoneNumberTask
        2. 8.1.3.2. PhoneNumberChooserTask
        3. 8.1.3.3. PhoneCallTask
        4. 8.1.3.4. SmsComposeTask
      4. 8.1.4. E-Mail
        1. 8.1.4.1. SaveEmailAddressTask
        2. 8.1.4.2. EmailAddressChooserTask
        3. 8.1.4.3. EmailComposeTask
      5. 8.1.5. Launchers
        1. 8.1.5.1. SearchTask
        2. 8.1.5.2. WebBrowserTask
        3. 8.1.5.3. MediaPlayerLauncher
        4. 8.1.5.4. Marketplace
    2. 8.2. EXTRAS
    3. 8.3. SUMMARY
  15. 9. Touch Input
    1. 9.1. USER EXPERIENCE
      1. 9.1.1. Guidelines
        1. 9.1.1.1. Target Size
        2. 9.1.1.2. Layout
        3. 9.1.1.3. Gestures
    2. 9.2. TOUCH EVENTS
      1. 9.2.1. Single Touch
        1. 9.2.1.1. Tap
      2. 9.2.2. Double-Tap
        1. 9.2.2.1. Pan
        2. 9.2.2.2. Flick
        3. 9.2.2.3. Touch and Hold
      3. 9.2.3. Multi-Touch
        1. 9.2.3.1. Simulating Multi-Touch
        2. 9.2.3.2. Pinch and Stretch
        3. 9.2.3.3. Touch Frames
    3. 9.3. SUMMARY
  16. 10. Shake, Rattle, and Vibrate
    1. 10.1. ACCELEROMETER
      1. 10.1.1. Working with the Emulator
        1. 10.1.1.1. Random Accelerometer Data
        2. 10.1.1.2. Wii Simulation
          1. 10.1.1.2.1. Connecting Your Wiimote
          2. 10.1.1.2.2. Publishing the Accelerometer Values
          3. 10.1.1.2.3. Consuming the Accelerometer Values
      2. 10.1.2. Reactive Extensions for .NET
    2. 10.2. VIBRATION
    3. 10.3. SUMMARY
  17. 11. Who Said That?
    1. 11.1. MEDIA PLAYBACK
      1. 11.1.1. MediaElement
        1. 11.1.1.1. Media Controls
        2. 11.1.1.2. Transforms
        3. 11.1.1.3. Clipping
      2. 11.1.2. SoundEffects with XNA
        1. 11.1.2.1. Volume, Balance, and Looping
        2. 11.1.2.2. 3D Sound
      3. 11.1.3. Microsoft Translator
    2. 11.2. AUDIO RECORDING
      1. 11.2.1. Playback
      2. 11.2.2. Saving
    3. 11.3. MUSIC AND VIDEO HUB
    4. 11.4. FM TUNER
    5. 11.5. SUMMARY
  18. 12. Where Am I? Finding Your Way
    1. 12.1. GEO-LOCATION
      1. 12.1.1. GeoCoordinateWatcher
        1. 12.1.1.1. Location (Latitude, Longitude, and Altitude)
        2. 12.1.1.2. Heading (Course and Speed)
        3. 12.1.1.3. Immediate Location
        4. 12.1.1.4. MovementThreshold and DesiredAccuracy
        5. 12.1.1.5. Accuracy
      2. 12.1.2. IGeoPositionWatcher
        1. 12.1.2.1. Mock: Windows 7 Sensor API
        2. 12.1.2.2. Mock: Time-Location
    2. 12.2. BING MAPS
      1. 12.2.1. Map Design
      2. 12.2.2. Map Credentials
      3. 12.2.3. Points of Interest and Lines
      4. 12.2.4. Events
      5. 12.2.5. Bing Maps Web Services
        1. 12.2.5.1. Route Service
        2. 12.2.5.2. Calculate Route
        3. 12.2.5.3. Displaying the Route
    3. 12.3. SUMMARY
  19. 13. Connectivity and the Web
    1. 13.1. CONNECTED STATUS
      1. 13.1.1. Network Availability
      2. 13.1.2. Service Reachability
      3. 13.1.3. Emulator Testing
      4. 13.1.4. Connectivity
        1. 13.1.4.1. Data Binding
    2. 13.2. WEBBROWSER CONTROL
    3. 13.3. MULTISCALEIMAGE
    4. 13.4. AUTHENTICATION
      1. 13.4.1. Windows Live ID
        1. 13.4.1.1. Web Authentication
        2. 13.4.1.2. Delegated Authentication
        3. 13.4.1.3. Personal and Contact Information
    5. 13.5. SUMMARY
  20. 14. Consuming the Cloud
    1. 14.1. HTTP REQUEST
      1. 14.1.1. WebClient
        1. 14.1.1.1. Uploading Content
      2. 14.1.2. HttpWebRequest
        1. 14.1.2.1. Uploading Content
        2. 14.1.2.2. Cookies
      3. 14.1.3. Credentials
      4. 14.1.4. Compression
    2. 14.2. WCF/ASMX SERVICES
      1. 14.2.1. Service Configuration
      2. 14.2.2. Add Service Reference
      3. 14.2.3. Service Implementation and Execution
      4. 14.2.4. Custom Headers
      5. 14.2.5. Credentials
    3. 14.3. WCF DATA SERVICES
      1. 14.3.1. OData with WCF Data Services
        1. 14.3.1.1. ADO.NET Entity Data Model
        2. 14.3.1.2. Queries
        3. 14.3.1.3. Custom Methods and Stored Procedures
        4. 14.3.1.4. Updates, Inserts, and Deletes
      2. 14.3.2. JSON
    4. 14.5. SUMMARY
  21. 15. Data Visualization
    1. 15.1. DATA BINDING
      1. 15.1.1. DataContext
      2. 15.1.2. BindingMode
      3. 15.1.3. Value Converters
    2. 15.2. DESIGNING WITH DATA
      1. 15.2.1. Sample Data
      2. 15.2.2. Design-Time Data
        1. 15.2.2.1. Model View ViewModel (MVVM)
        2. 15.2.2.2. Creating Your ViewModel
        3. 15.2.2.3. Creating a Data Source
        4. 15.2.2.4. Building the User Interface
        5. 15.2.2.5. Separating Design and Runtime Data
      3. 15.2.3. MVVM Light Toolkit
        1. 15.2.3.1. Base View Model
        2. 15.2.3.2. Command Pattern
      4. 15.2.4. Element and Resource Binding
    3. 15.3. SUMMARY
  22. 16. Storing and Synchronizing Data
    1. 16.1. ISOLATED STORAGE
      1. 16.1.1. ApplicationSettings
        1. 16.1.1.1. Data-Binding
      2. 16.1.2. IsolatedStorageFileStream
    2. 16.2. DATA-CACHING
      1. 16.2.1. Object Cache
      2. 16.2.2. Persistent Storage
        1. 16.2.2.1. IStorageProvider: JSON Serialization
        2. 16.2.2.2. Persisting Objects
      3. 16.2.3. Synchronization
        1. 16.2.3.1. ISyncProvider: WCF Data Service
    3. 16.3. SUMMARY
  23. 17. Frameworks
    1. 17.1. MANAGED EXTENSIBILITY FRAMEWORK
      1. 17.1.1. Import and Export
      2. 17.1.2. ImportMany
    2. 17.2. APPLICATION COMPOSITION
    3. 17.3. MICROSOFT SILVERLIGHT ANALYTICS FRAMEWORK
    4. 17.4. TESTING
      1. 17.4.1. Unit Testing
        1. 17.4.1.1. Getting Started
        2. 17.4.1.2. Test Attributes
          1. 17.4.1.2.1. Description
          2. 17.4.1.2.2. Bug
          3. 17.4.1.2.3. WorkItem
          4. 17.4.1.2.4. Tag
          5. 17.4.1.2.5. Ignore
          6. 17.4.1.2.6. ExpectedException
          7. 17.4.1.2.7. Asynchronous
          8. 17.4.1.2.8. Timeout
          9. 17.4.1.2.9. TestInitialize and TestCleanup
          10. 17.4.1.2.10. ClassInitialize and ClassCleanup
        3. 17.4.1.3. Visual Studio Test Report
      2. 17.4.2. Emulator Automation
    5. 17.5. SUMMARY
  24. 18. Security
    1. 18.1. ON THE DEVICE
      1. 18.1.1. Device Security
      2. 18.1.2. Device Management
      3. 18.1.3. Data Encryption
    2. 18.2. OVER THE WIRE
      1. 18.2.1. Transport
      2. 18.2.2. Authentication
        1. 18.2.2.1. Basic
        2. 18.2.2.2. Forms (WCF Authentication Services)
        3. 18.2.2.3. OAuth 1.0 (Twitter)
          1. 18.2.2.3.1. Step 1: Retrieve a Request Token from Twitter
          2. 18.2.2.3.2. Step 2: Navigate to the AuthorizeUri
          3. 18.2.2.3.3. Step 3: User Signs into Twitter
          4. 18.2.2.3.4. Step 4: WebBrowser Navigated Event Is Detected and the PIN Is Extracted
          5. 18.2.2.3.5. Step 5: Access Token Is Retrieved
        4. 18.2.2.4. OAuth 2.0 (Facebook)
          1. 18.2.2.4.1. Step 1: Prepare Authorization URL
          2. 18.2.2.4.2. Step 2: Navigate to Authorization URL
          3. 18.2.2.4.3. Step 3: User Signs into Facebook Account
          4. 18.2.2.4.4. Step 4: Navigated Event Is Intercepted
          5. 18.2.2.4.5. Step 5: Extract Access Token
    3. 18.3. SUMMARY
  25. 19. Gaming with XNA
    1. 19.1. GETTING STARTED
      1. 19.1.1. Game Loop
        1. 19.1.1.1. Fixed Time Step
        2. 19.1.1.2. Variable Time Step
      2. 19.1.2. Game Life Cycle
        1. 19.1.2.1. Loading and Unloading Content
        2. 19.1.2.2. Exiting the Game
        3. 19.1.2.3. Application Events
    2. 19.2. RENDERING
      1. 19.2.1. Content
      2. 19.2.2. Sprites
      3. 19.2.3. Movement
      4. 19.2.4. Text and Fonts
    3. 19.3. INPUT
      1. 19.3.1. Accelerometer
      2. 19.3.2. Touch
      3. 19.3.3. Keyboard
    4. 19.4. 3D RENDERING
      1. 19.4.1. 3D Model
      2. 19.4.2. Color and Lighting
      3. 19.4.3. Primitives
      4. 19.4.4. Textures
    5. 19.5. SUMMARY
  26. 20. Where to Next?
    1. 20.1. DEVICE DEBUGGING
      1. 20.1.1. Registering for Development
      2. 20.1.2. Debugging Applications
      3. 20.1.3. Deploying Applications
    2. 20.2. THIRD-PARTY COMPONENTS
      1. 20.2.1. Silverlight Toolkit
      2. 20.2.2. Database
    3. 20.3. APPLICATION MIGRATION
      1. 20.3.1. User Interface
      2. 20.3.2. Services and Connectivity
      3. 20.3.3. Data
      4. 20.3.4. Device Capabilities
      5. 20.3.5. Background Processing
    4. 20.4. USER INTERFACE PERFORMANCE
      1. 20.4.1. Performance Counters
      2. 20.4.2. Redraw Regions
      3. 20.4.3. Caching
    5. 20.5. EXTERNAL SYSTEMS
      1. 20.5.1. Proxy Service (Exchange)
      2. 20.5.2. Shared Key Signatures (Windows Azure)
    6. 20.6. PUBLISHING
      1. 20.6.1. Application and Start Icons
      2. 20.6.2. Splash Screen
      3. 20.6.3. Capabilities
      4. 20.6.4. Trial Mode and Marketplace
    7. 20.7. SUMMARY