Foreword xixPreface xxii Chapter 1 The New Windows Runtime 1 Windows Runtime Specifics 1Windows Store Apps 4 Example: Create a Windows Store App 5.NET and WinRT 9 Fundamental Types 9 Mapped Types 10 Streams and Buffers 14Desktop Applications 15 Example: Reference WinRT from a Desktop Application 15 Example: Examine Projections in a WinRT Component 20Asynchronous Functions 24Summary 27 Chapter 2 Windows Store Apps and WinRT Components 29 Fundamentals of a Windows Store App 30 Windows Store App Templates 32 Understanding the App Manifest 45 Finding Your Package on Disk 52 Running Your App 54Application Lifecycle 61 The Navigation Helper and Suspension Manager 67Managed WinRT Components 75 Creating a Managed WinRT Component 76 Calling Managed WinRT Components from Any Language 78Summary 79 Chapter 3 Layouts and Controls 81 The Visual Tree 83Data-Binding 85 Dependency Properties 91 Attached Properties 94 Value Precedence 95 Property Change Notification 95Animations 97 Example: Dynamically Apply Animations to a Control 97The Visual State Manager 100 Example: Visual State Manager 101 Groups 103 States 105 Transitions 106The Visual State Manager Workflow 107Programmatic Access to Visual States 109Custom Visual State Managers 109Styles 111Templates 112 Example: Using Templates 112Layouts 115 Panel 115 Border 115 Canvas 116 Grid 116 StackPanel 117 VirtualizingPanel and VirtualizingStackPanel 118 WrapGrid 119 VariableSizedWrapGrid 119 ContentControl 120 ItemsControl 121 ScrollViewer 122 ViewBox 122 GridView 123 ListBox 123 ListView 124 FlipView 124 Example: Using the Viewbox and Various Layouts 125Controls 130 Flyouts 133Custom Controls 135 Example: Creating a Custom Control 136Parsing XAML 140HTML Pages 143 Example: Working with HTML and JavaScript 144Summary 150 Chapter 4 Data and Content 153 Example: Data Manipulation with the Skrape App 154The Clipboard 154Application Storage 159 Roaming Data 161 Containers 162 Settings 163 Composite Values 165Storage Folders and Files 166 Storage Folders 168 Storage Files 170 Buffers and Streams 171 Path and File Helper Classes 174 Storage Query Operations 176 Pickers and Cached Files 180 Compression 187Data Formats 191 Example: Working with Data Formats 192 XSLT Transformations 195Document Data 196Summary 198 Chapter 5 Web Services and Syndication 199 SOAP 200REST 209OData Client 217Syndication 219Summary 223 Chapter 6 Tiles and Toasts 225 Tiles 226 Default Tiles 227 Live Tiles 229 Cycling Tile Notifications 234 Secondary Tiles 236Badges 239Periodic Notifications 242Toasts 242 Toasts in Desktop Applications 248Push Notifications 249 Registering to Receive Push Notifications 251 Sending Push Notifications 253Summary 259 Chapter 7 Connecting to the Cloud 261 Windows Azure Mobile Services 262 Example: Managing a Shared Group of Subscribers 267 Connecting an App to a Mobile Services Instance 267 Authentication 269 Data Storage 274 Custom APIs 289 Integrated Push Notification Support 291 Scheduled Tasks 297 Mobile Services Deployment Tiers 298Live Connect 301 Getting Started 302 The Example App 304 Authentication 304 Working with Profile Information 308 Working with Contacts 310 Working with Calendars and Events 311 Working with OneDrive 315Summary 321 Chapter 8 Security 323 Authentication 324 Multistep Authentication (Google) 330 Unlocking the Password Vault 331Encryption and Signing 333 The Data Protection Provider 333 Symmetrical Encryption 337 Verification 343 Asymmetric Algorithms 345Summary 347 Chapter 9 Model-View-ViewModel (MVVM) 349 UI Design Patterns 350 The Model 351 The View 352 Model-View-Controller (MVC) 353 Model-View-Presenter (MVP) 354 Model-View-ViewModel (MVVM) 355The ViewModel Decomposed 356Common MVVM Misperceptions 362Benefits of MVVM 364Common MVVM Solutions 367 Design-Time Data 367 Accessing the UI Thread 369 Commands 371 Handling Dialogs 371 Selection Lists 371 Filtered Lists 373 Validation 375Summary 377 Chapter 10 Networking 379 Web and HTTP 379HomeGroup 382Connectivity and Data Plans 384Sockets 389 WebSockets 389 UDP and TCP Sockets 392Proximity (Near Field Communications) 397 NFC-Only Scenarios 397 Tap-to-Connect Scenarios 403Background Transfers 408Summary 412 Chapter 11 Windows Charms Integration 415 Displaying App Settings 417 The Settings Example 418 Adding Settings Entries 418Sharing 421 The Share Source Example 423 Creating a Share Source App 424 The Share Target Example 433 Creating a Share Target App 434 Debugging Share Target Apps 441Using Play To 442 The Play To Example 443 Creating a Play To Source App 444 Creating a Play To Target App 446Summary 448 Chapter 12 Additional Windows Integration 451 Integrating with the File and Contact Pickers 452 The Example App 453 File Open Picker 454 File Save Picker 458 Contact Picker 460Application Activation Integration 462 The Example App 463 File Activation 463 Protocol Activation 467 Account Picture Provider 470 AutoPlay 471Working with Contacts and Appointments 473 The Example App 474 Contacts 474 Appointments 476Summary 478 Chapter 13 Devices 479 Working with Input Devices 480 The Example App 480 Identifying Connected Input Devices 481 Pointer, Manipulation, and Gesture Events 484 Keyboard Input 495Sensor Input 498 The Example App 498 Geolocation 502 Geofencing 510 Motion and Orientation Sensors 517Summary 529 Chapter 14 Printers and Scanners 531 Working with Printers 532 The Example App 532 Getting Started 533 Configuring a Print Task 534 Providing Printing Content 542Working with Scanners 547 The Example App 547 Determining Scanner Availability 548 Working with Scan Sources 549 Previewing 550 Scanning 551 Scanner Settings 552Summary 556 Chapter 15 Background Tasks 559 The Thread Pool 560Uploads and Downloads 562Audio 563 Lock Screen Tasks 570 Lock Screen Capabilities 570 The Background Task 573 Listing Background Tasks 576 Timer 578 Conditions 578 Debugging Background Tasks 580Raw Push Notifications 581Control Channel 585System Events 587Summary 588 Chapter 16 Multimedia 589 Playing Multimedia Content 590 The Example App 590 Getting Started 591 Controlling Playback 592 Appearance 595 Audio Settings 596 Media Information 597 Markers 597Acquiring Audio and Video 598 The Example App 599 Declaring Application Capabilities 599 Using CameraCaptureUI 600 Using MediaCapture 604Text-to-Speech Support 610 The Example App 611 Using the SpeechSynthesizer 611Summary 613 Chapter 17 Accessibility 615 Requested Theme 616 High Contrast 618Keyboard Support 620Automation Properties 622Testing with Narrator 623Automation and Lists 624Live Settings 625Automation Peers 626Accessibility Checker 627Summary 629 Chapter 18 Globalization and Localization 631 Design Considerations 632Default Language 633Configuring Preferred Languages 635Resource Qualification and Matching 637Localizing XAML Elements 639Formatting Dates, Numbers, and Currencies for Locale 642MVVM and Localization 643Multilingual Toolkit 644Summary 648 Chapter 19 Packaging and Deploying 649 Packaging Your App 650 Creating an App Package 650 App Package and App Bundle Contents 654 Package Identifier 655Deploying Your App 657 Publishing Your App in the Windows Store 657 Other Deployment Options 665Making Money with Your App in the Windows Store 667 The Example App 668 Pricing Your App in the Windows Store 669 Trial Mode Apps 670 In-App Purchases 675 Including Advertisements 678Summary 683 Chapter 20 Debugging and Performance Optimization 685 Understanding the Debugger 686 Native, Managed, and Script Debuggers 686 Just My Code 688 Edit and Continue 690 Just in Time Debugging 691 How to Launch the Debugger 691 Program Databases 692 Debug Windows 693 Managing Exceptions 694Logging and Tracing 696Profiling and Performance Analysis 702 Performance Tips 704 CPU Sampling 706 XAML UI Responsiveness 709 Energy Consumption 710Code Analysis 712Summary 717 Appendix A Under the Covers 719 Fundamental WinRT Concepts 719Namespaces 720Base Types 720Primitives 720Classes and Class Methods 721Structures 722Generics 722Null 723Enumerations 723Interfaces 723Properties 723Delegates 724Events 724Arrays 725WinRT Internals 725 Appendix B Glossary 733Index 749.
Programming the Windows Runtime by Example : A Comprehensive Guide to WinRT with Examples in C# and XAML