Windows Runtime via C#

Book description

Delve inside the Windows Runtime - and learn best ways to design and build Windows Store apps. Guided by Jeffrey Richter, a recognized expert in Windows and .NET programming, along with principal Windows consultant Maarten van de Bospoort, you'll master essential concepts. And you'll gain practical insights and tips for how to architect, design, optimize, and debug your apps.

With this book, you will:

  • Learn how to consume Windows Runtime APIs from C#

  • Understand the principles of architecting Windows Store apps

  • See how to build, deploy, and secure app packages

  • Understand how apps are activated and the process model controlling their execution

  • Study the rich features available when working with files and folders

  • Explore how to transfer, compress, and encrypt data via streams

  • Design apps that give the illusion of running using live tiles, background transfers, and background tasks

  • Share data between apps using the clipboard and the Share charm

  • Get advice for monetizing your apps through the Windows Store

  • About This Book

  • Requires working knowledge of Microsoft .NET Framework, C#, and the Visual Studio IDE

  • Targeted to programmers building Windows Store apps

  • Some chapters also useful to those building desktop apps

  • Technologies Covered

  • Windows 8.1

  • Microsoft Visual Studio 2013

  • Table of contents

    1. Windows Runtime via C#
    2. Dedication
    3. Foreword
    4. Introduction
      1. Who should read this book
        1. Assumptions
      2. Who should not read this book
      3. Organization of this book
      4. Code samples
      5. Acknowledgments
      6. Errata & book support
      7. We want to hear from you
      8. Stay in touch
    5. I. Core concepts
      1. 1. Windows Runtime primer
        1. Windows Store app technology stacks
        2. The Windows Runtime type system
        3. Windows Runtime type-system projections
        4. Calling asynchronous WinRT APIs from .NET code
          1. Simplifying the calling of asynchronous methods
          2. Cancellation and progress
          3. WinRT deferrals
      2. 2. App packaging and deployment
        1. A Windows Store app’s project files
        2. The app’s package manifest file
          1. Package identity
          2. Capabilities
          3. App (not package) declarations (extensions/contracts)
        3. Building a Windows Store app package
          1. Contents of an .appx package file
          2. Creating a bundle package file
        4. Deploying a Windows Store package
          1. Restricted deployments
          2. Enterprise deployments
          3. Windows Store deployments
        5. Package staging and registration
        6. Wintellect’s Package Explorer desktop app
        7. Debugging Windows Store apps
      3. 3. Process model
        1. App activation
        2. Managing the process model
        3. XAML page navigation
        4. Process lifetime management
          1. Windows Store app suspension
          2. Windows Store app termination
          3. How to best structure your app class’ code
          4. Debugging process lifetime management
    6. II. Core Windows facilities
      1. 4. Package data and roaming
        1. Package data settings
        2. Package data storage folders
        3. Versioning package data
        4. Roaming package data
        5. Package data change notifications
      2. 5. Storage files and folders
        1. The WinRT storage object model
        2. Package and user files
        3. Accessing read-only package files
        4. Accessing read-write package files
        5. Accessing user files via explicit user consent
        6. File-type associations
        7. Storage item properties
        8. Accessing user files with implicit user consent
        9. Performing file and folder queries
      3. 6. Stream input and output
        1. Simple file I/O
        2. The streams object model
        3. Interoperating between WinRT streams and .NET streams
        4. Transferring byte buffers
        5. Writing and reading primitive data types
        6. Performing transacted write operations
        7. Polite reader data access
        8. Compressing and decompressing data
        9. Encrypting and decrypting data
        10. Populating a stream on demand
        11. Searching over a stream’s content
      4. 7. Networking
        1. Network information
        2. Network isolation
        3. Network connection profile information
          1. How your app must use connectivity profile information
          2. Network connectivity change notifications
        4. Background transfer
          1. Debugging background transfers
        5. HttpClient: Client-side HTTP(S) communication
          1. HttpBaseProtocolFilter
        6. Windows Runtime sockets
          1. Socket addressing
          2. StreamSocket: Client-side TCP communication
          3. StreamSocketListener: Server-side TCP communication
          4. StreamWebSocket: Streaming client-side WebSocket communication
          5. MessageWebSocket: Messaging client-side WebSocket communication
          6. DatagramSocket: Peer-to-peer UDP communication
          7. DatagramSocket: Multicast UDP communication
        7. Encrypting data traversing the network with certificates
      5. 8. Tile and toast notifications
        1. Tiles and badges
          1. Updating a tile when your app is in the foreground
          2. Placing a badge on a tile
          3. Animating a tile’s contents
          4. Updating a tile at a scheduled time
          5. Updating a tile periodically
          6. Secondary tiles
        2. Toast notifications
          1. Showing a toast notification at a scheduled time
          2. Using the Wintellect Notification Extension Library
          3. Windows Push Notification Service (WNS)
            1. Registering your app and the user’s PC with WNS
            2. Send the channel URI to your app’s web service
            3. Pushing a notification from your app’s web service to the user’s PC
      6. 9. Background tasks
        1. Background task architecture
        2. Step 1: Implement your background task’s code
        3. Step 2: Decide what triggers your background task’s code
          1. Maintenance and time triggers
          2. System triggers
          3. Location triggers
          4. Push notification triggers
          5. Control channel triggers
        4. Step 3: Add manifest declarations
          1. Lock-screen apps
        5. Step 4: Register your app’s background tasks
        6. Debugging background tasks
        7. Background task resource quotas
        8. Deploying a new version of your app
        9. Background task progress and completion
        10. Background task cancellation
      7. 10. Sharing data between apps
        1. Apps transfer data via a DataPackage
        2. Sharing via the clipboard
        3. Sharing via the Share charm
        4. Implementing a share source app
          1. Delayed rendering of shared content
        5. Implementing a share target app
          1. Implementing an extended (lengthy) share operation
          2. Share target app quick links
        6. Debugging share target apps
      8. 11. Windows Store
        1. Submitting a Windows Store app to the Windows Store
          1. Submitting your app
          2. Testing your app
          3. Monitoring your app
          4. Updating your app
        2. The Windows Store commerce engine
          1. The Windows Store commerce engine WinRT APIs
          2. App trials and purchasing an app license
          3. Purchasing durable in-app product licenses
          4. Purchasing consumable in-app products
          5. Purchasing consumable in-app product offers
    7. A. App containers
    8. B. About the authors
    9. Index
    10. About the Authors
    11. Copyright

    Product information

    • Title: Windows Runtime via C#
    • Author(s): Jeffrey Richter and Maarten van de Bospoort
    • Release date: November 2013
    • Publisher(s): Microsoft Press
    • ISBN: 9780735679269