Home > Store

Programming the Windows Runtime by Example: A Comprehensive Guide to WinRT with Examples in C# and XAML

Register your product to gain access to bonus material or receive a coupon.

Programming the Windows Runtime by Example: A Comprehensive Guide to WinRT with Examples in C# and XAML

eBook

  • Your Price: $42.39
  • List Price: $52.99
  • About Watermarked eBooks
  • This PDF will be accessible from your Account page after purchase and requires PDF reading software, such as Acrobat® Reader®.

    The eBook requires no passwords or activation to read. We customize your eBook by discreetly watermarking it with your name, making it uniquely yours.

    Watermarked eBook FAQ

Description

  • Copyright 2014
  • Dimensions: 7" x 9-1/8"
  • Edition: 1st
  • eBook
  • ISBN-10: 0-13-343038-3
  • ISBN-13: 978-0-13-343038-7

Master Windows 8.1/Windows Runtime Programming Through 80 Expert Projects
This is the most complete, hands-on, solutions-focused guide to programming modern Windows applications with the Windows Runtime.

Leading Windows development consultants Jeremy Likness and John Garland present easy-to-adapt C# and XAML example code for more than 80 projects. Their real-world application examples help you apply Windows 8.1’s best improvements, including large tiles, the new search control, flyouts, command bars, native WinRT networking, and new deployment and sideloading options.

Drawing on their pioneering experience, they illuminate key areas of the Windows Runtime API, offering uniquely detailed coverage of encryption, cloud connectivity, devices, printers, and media integration. You’ll find cutting-edge tips and tricks available in no other book.

This is an indispensable resource for all intermediate-to-advanced Windows developers, and for any architect building desktop, tablet, or mobile solutions with Microsoft technologies. Its focus on both C# and XAML will make it valuable to millions of Windows developers already familiar with Silverlight, WPF, and/or .NET.

Coverage includes
• Creating robust app interfaces with the newest XAML controls, including flyouts and command bars
• Saving data in a persistent “roaming zone” for syncing across Windows 8.1 devices
• Using Visual State Manager (VSM) to build apps that adapt to various device resolutions and orientations
• Integrating virtually any form of data into your apps
• Connecting with web services, RSS, Atom feeds, and social networks
• Securing apps via authentication, encrypting, signing, and single sign-on with Microsoft Account, Facebook, Google, and more
• Leveraging Windows 8.1 media enhancements that improve battery life and app performance
• Networking more effectively with Windows 8.1’s revamped HTTP implementation and new location APIs
• Using Tiles and Toasts to keep apps alive and connected, even when they aren’t running
• Enabling users to send content between devices via NFC tap and send
• Ensuring accessibility and globalizing your apps
• Efficiently debugging, optimizing, packaging, and deploying your apps
• Building sideloadable apps that don’t have to be published in Windows Store

“This book doesn’t just focus on singular concepts, it also provides end-to-end perspective on building an app in WinRT. It is one of those essential tools for Windows developers that will help you complete your software goals sooner than without it!”
—Tim Heuer, Principal Program Manager Lead, XAML Platform, Microsoft Corporation


Sample Content

Table of Contents

Foreword     xix
Preface     xxii

Chapter 1  The New Windows Runtime     1
Windows Runtime Specifics     1
Windows Store Apps     4
   Example: Create a Windows Store App     5
.NET and WinRT    9
   Fundamental Types     9
   Mapped Types     10
   Streams and Buffers     14
Desktop Applications     15
   Example: Reference WinRT from a Desktop Application     15
   Example: Examine Projections in a WinRT Component     20
Asynchronous Functions     24
Summary     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     54
Application Lifecycle     61
   The Navigation Helper and Suspension Manager     67
Managed WinRT Components    75
   Creating a Managed WinRT Component     76
   Calling Managed WinRT Components from Any Language     78
Summary     79
Chapter 3  Layouts and Controls     81
The Visual Tree    83
Data-Binding     85
   Dependency Properties     91
   Attached Properties    94
   Value Precedence    95
   Property Change Notification    95
Animations    97
   Example: Dynamically Apply Animations to a Control     97
The Visual State Manager    100
   Example: Visual State Manager     101
   Groups     103
   States     105
   Transitions     106
The Visual State Manager Workflow     107
Programmatic Access to Visual States    109
Custom Visual State Managers     109
Styles    111
Templates     112
   Example: Using Templates     112
Layouts     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     125
Controls     130
   Flyouts     133
Custom Controls     135
   Example: Creating a Custom Control     136
Parsing XAML     140
HTML Pages     143
   Example: Working with HTML and JavaScript     144
Summary     150
Chapter 4  Data and Content     153
Example: Data Manipulation with the Skrape App    154
The Clipboard     154
Application Storage     159
   Roaming Data     161
   Containers     162
   Settings     163
   Composite Values     165
Storage 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     187
Data Formats    191
   Example: Working with Data Formats     192
   XSLT Transformations     195
Document Data     196
Summary     198
Chapter 5  Web Services and Syndication     199
SOAP     200
REST     209
OData Client     217
Syndication     219
Summary     223
Chapter 6  Tiles and Toasts     225
Tiles     226
   Default Tiles     227
   Live Tiles     229
   Cycling Tile Notifications     234
   Secondary Tiles     236
Badges     239
Periodic Notifications     242
Toasts     242
   Toasts in Desktop Applications     248
Push Notifications     249
   Registering to Receive Push Notifications     251
   Sending Push Notifications     253
Summary     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     298
Live 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     315
Summary     321
Chapter 8  Security     323
Authentication     324
   Multistep Authentication (Google)     330
   Unlocking the Password Vault     331
Encryption and Signing    333
   The Data Protection Provider     333
   Symmetrical Encryption     337
   Verification     343
   Asymmetric Algorithms     345
Summary     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)     355
The ViewModel Decomposed     356
Common MVVM Misperceptions     362
Benefits of MVVM     364
Common MVVM Solutions     367
   Design-Time Data     367
   Accessing the UI Thread     369
   Commands     371
   Handling Dialogs     371
   Selection Lists     371
   Filtered Lists     373
   Validation     375
Summary     377
Chapter 10  Networking     379
Web and HTTP     379
HomeGroup     382
Connectivity and Data Plans     384
Sockets     389
   WebSockets     389
   UDP and TCP Sockets    392
Proximity (Near Field Communications)     397
   NFC-Only Scenarios     397
   Tap-to-Connect Scenarios     403
Background Transfers     408
Summary     412
Chapter 11  Windows Charms Integration     415
Displaying App Settings     417
   The Settings Example     418
   Adding Settings Entries     418
Sharing     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     441
Using Play To     442
   The Play To Example     443
   Creating a Play To Source App     444
   Creating a Play To Target App     446
Summary     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     460
Application Activation Integration     462
   The Example App     463
   File Activation     463
   Protocol Activation     467
   Account Picture Provider     470
   AutoPlay     471
Working with Contacts and Appointments     473
   The Example App     474
   Contacts     474
   Appointments     476
Summary     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     495
Sensor Input     498
   The Example App     498
   Geolocation     502
   Geofencing     510
   Motion and Orientation Sensors     517
Summary     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     542
Working with Scanners    547
   The Example App     547
   Determining Scanner Availability     548
   Working with Scan Sources    549
   Previewing     550
   Scanning     551
   Scanner Settings     552
Summary     556
Chapter 15  Background Tasks     559
The Thread Pool     560
Uploads and Downloads     562
Audio 563   
Lock Screen Tasks    570
   Lock Screen Capabilities     570
   The Background Task     573
   Listing Background Tasks     576
   Timer     578
   Conditions     578
   Debugging Background Tasks     580
Raw Push Notifications     581
Control Channel     585
System Events     587
Summary     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     597
Acquiring Audio and Video     598
   The Example App     599
   Declaring Application Capabilities     599
   Using CameraCaptureUI     600
   Using MediaCapture     604
Text-to-Speech Support     610
   The Example App     611
   Using the SpeechSynthesizer     611
Summary     613
Chapter 17  Accessibility    615
Requested Theme     616
   High Contrast     618
Keyboard Support     620
Automation Properties     622
Testing with Narrator     623
Automation and Lists     624
Live Settings     625
Automation Peers     626
Accessibility Checker     627
Summary     629
Chapter 18  Globalization and Localization     631
Design Considerations     632
Default Language     633
Configuring Preferred Languages    635
Resource Qualification and Matching     637
Localizing XAML Elements     639
Formatting Dates, Numbers, and Currencies for Locale     642
MVVM and Localization    643
Multilingual Toolkit    644
Summary     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     655
Deploying Your App     657
   Publishing Your App in the Windows Store    657
   Other Deployment Options     665
Making 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     678
Summary     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     694
Logging and Tracing     696
Profiling and Performance Analysis     702
   Performance Tips     704
   CPU Sampling     706
   XAML UI Responsiveness     709
   Energy Consumption    710
Code Analysis     712
Summary     717
Appendix A  Under the Covers     719
Fundamental WinRT Concepts     719
Namespaces     720
Base Types     720
Primitives     720
Classes and Class Methods     721
Structures     722
Generics     722
Null     723
Enumerations     723
Interfaces     723
Properties     723
Delegates     724
Events     724
Arrays     725
WinRT Internals     725
Appendix B  Glossary     733
Index     749



Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020