Table of Contents
Introduction xxv
Chapter 1 A Glimpse into the Future 1
The Game Changer 1
What Makes Windows 8 Different? 2
Understanding Windows 8: The Zune Concept 3
Windows Phone 7 Carry-overs 4
Getting Around in Windows 8 4
The Login Screen 5
The Start Screen 5
The Search Feature 6
Application Life Cycle 7
Accessing Desktop Mode 7
Windows Store App Development 10
Hello Windows 8 13
Selecting a Language and Default Folders 13
Building a Simple Windows Store App 14
Setting App Capabilities 16
What About HTML Developers? 21
Types of Windows Store Apps 23
Grid Applications 24
Split Applications 44
Creating a Split Application 44
Summary 48
Chapter 2 What Is XAML? 49
A Quick XAML History Lesson 50
XAML Basics 51
XAML in Visual Studio 2012 53
Controls for Windows 8 54
Layout Controls 55
Action Controls 66
Summary 78
Chapter 3 Enhancing Your Apps with Control Styles, Data Binding, and Semantic Zoom 79
Customizing Your Apps 79
Styling Controls 80
Understanding Basic Styling 80
Referencing Styles Across an App 86
Using Microsoft's Default Styles 88
Data Binding 91
Understanding Basic Data Entry 91
Binding Objects to the User Interface 92
Updating Data with Two-Way Data Binding 96
Data Binding Summary 98
Windows 8 Data Binding Controls 98
ComboBox 98
ListBox 101
ListView 102
GridView 106
Grouped GridView 108
Using SemanticZoom 113
Using Custom Controls 116
Summary 119
Chapter 4 Windows 8 User Interface Final Touches 121
Application Bars, Notifications, Splash Screens, and Live Tiles 121
Working with the App Bar 122
Creating the Top App Bar Navigation 123
Wiring Up the App Pages 129
Adding Filtering Capability 133
Adding Finishing Touches to the App 135
Adding Notifications 136
Understanding Templates 136
A Toast Example 139
Creating Live Tiles 143
Available Tile Templates 144
Live Tiles Example 145
Splash Screen 149
Summary 150
Chapter 5 Application Life Cycle 151
Applications Reborn 151
What Is the Windows 8 Life Cycle? 151
App Launch 152
App Activation 162
App Resume 165
App Close 167
Background Operations 168
Triggers and Conditions 169
Lock Screen 174
Progress Reporting 174
Debugging 178
Deadlock 179
Summary 179
Chapter 6 Handling Data, Files, and Networking 181
Getting Started with Data, Files, and Networking 182
Handling Application Data and Files 182
Getting Started with the Data Samples App 182
Understanding Windows Storage API 184
Working with Data and Files Locations 185
File Access Permissions 186
Local Settings and Application Data 188
Roaming Settings and Application Data 190
Temporary Application Data 192
Versioning Application Data 192
Clearing Application Data 193
Displaying Pictures Library Content 193
Selecting Files: User Experience 197
Tracking Files and Folders 199
Serializing and Deserializing Data 201
Data Encryption and Decryption 203
Networking 204
Establishing Socket Connectivity 204
Data Transfers 211
Activating Proximity and Tapping 215
Syndicated Content 221
Accessing Network Information 222
Example: Leaderboard App 223
Summary 228
Chapter 7 Sensors 229
Windows Sensor Platform 229
Hardware for the Sensor Platform 230
Windows Sensor Platform Overview 230
Using the 3-D Accelerometer 232
Using the 3-D Compass 234
Using the Compass Class 234
Calculating True North Headings 236
Using the 3-D Gyrometer 237
Using the Inclinometer 239
Using the Ambient Light Sensor 241
Using the Orientation Sensors 243
Using the OrientationSensor Class 243
Using the SimpleOrientationSensor Class 245
Summary 247
Chapter 8 Geolocation 249
What Is Geolocation? 249
Geolocation in Windows 8 251
Using the Geolocator Class 251
Understanding the CivicAddress Class 253
Using the Bing Maps SDK 256
Referencing the Bing Maps SDK 256
Using the Bing.Maps.Map Class 257
Using Pushpins on the Map 258
Adding Traffic Information 260
Getting Directions 262
Enabling Directions with Pushpins 263
Summary 267
Chapter 9 Application Contracts and Extensions 269
App Contracts and Extensions 269
Using the File Picker Contract 270
Selecting a Single File 270
Selecting Multiple Files 271
Selecting Files from Windows Store Apps 272
Debugging File Picker Activation 275
Using the Cached File Updater Contract 276
Using the Play To Contract 276
Introducing the PlayToManager Class 276
Testing PlayTo Scenarios 278
Using the Search Contract 279
Using the Settings Contract 284
Using the Share Contract 285
Introducing the DataTransferManager Class 286
DataTransferManager.DataRequested 286
DataTransferManager.TargetApplicationChosen 286
Share Contract Scenarios 287
Using the Account Picture Provider Extension 287
Using the AutoPlay Extension 289
Using the Background Tasks Extension 291
Using Push Notifications 291
Using Background Tasks 292
Using the Camera Settings Extension 293
Using the Contact Picker Extension 294
Using the File Activation Extension 295
Implementing the File Activation Extension 295
Debugging File Activation 296
Using the Game Explorer Extension 297
Using the Print Task Settings Extension 298
Using the Protocol Activation Extension 298
Activating the Maps App 298
Making the Required Declarations 299
Debugging Protocol Activation 300
Using SSL/Certificates Extension 301
Summary 302
Chapter 10 Windows Store Application Architecture 303
Best Practices for Your Apps 303
Understanding MVVM 304
Locating ViewModels 306
Refactoring the Artist Browser 307
Instantiating a ViewModelLocator 308
Removing DefaultViewModel 314
Simplifying the Models 324
Using Commands to Handle Input 326
Using MVVM Frameworks 332
Understanding MVVM Light 332
Messaging in MVVM Light 335
Summary 337
Chapter 11 Windows Store and Monetization 339
Windows Store Overview 339
How Consumers See Your App 340
App Discovery 341
Making the First Good Impression 342
Promoting Your App 343
Selling Your Apps 343
Windows Store Economics 344
Windows Store API Overview 344
Getting Started with the Color Shopping App 345
Supporting Trials 349
In-App Purchases 360
Adding Advertisements 368
Summary: The Economics of Monetizing Your App 372
Application Packaging 374
Preparing your app in Visual Studio 375
Packaging Apps Using a Command Line 379
Packaging Enterprise Line-of-Business (LOB) Apps 380
Testing with Windows App Certification Kit 381
Understanding Windows Store Certification Requirements 381
Summary 382
Chapter 12 Putting It All Together: Building A Windows Store Application 383
Welcome to the Final Chapter of the Book 383
Designing the Wrox Bookstore App 384
Displaying Wrox Press Books 384
Adding a Wish List Across Devices 386
Diving into the Code 387
Getting Ready for MVVM 388
Creating Sample Data 391
Creating the Home Page 399
Configuring the XAML 400
Updating the ViewModel 406
Finishing the Code Behind 409
Drilling Down into Groups 411
Configuring the XAML 411
Updating the View Model 416
Finishing the Code Behind 418
Showing Detailed Book Information 422
Configuring the XAML 422
Updating the View Model 427
Finishing the Code Behind 428
Providing a Wish List Feature with SkyDrive 430
Making Files Available Locally 430
Registering Your App 434
Loading/Creating the Wish List File 434
Saving the Wish List File 439
Adding the Commands 440
Updating the Tile and Splash Screen 441
Getting Ready for the Store 442
Opening a Developer Account 443
Reserving an App Name 443
Acquiring a Developer License 444
Editing the App Manifest 444
Associating the App with the Store 445
Capturing Screenshots 445
Creating App Packages 446
Uploading App Packages 446
Concluding Remarks on the Store Checklist 447
Summary 447
Index 449