You are previewing Programming Windows Store Apps with C#.
O'Reilly logo
Programming Windows Store Apps with C#

Book Description

If you’re a .NET developer looking to build tablet apps, this practical book takes you step-by-step through the process of developing apps for the Windows Store. You’ll learn how to use Microsoft’s Modern UI design language with Windows 8.1 and WinRT 8.1.1 by building a line-of-business mobile app with C# through the course of the book.

Table of Contents

  1. Preface
    1. Audience
    2. The Application
    3. The Chapters
    4. Prerequisites
    5. Source Code
      1. Using git
    6. Contacting the Authors
    7. Let’s Go!
    8. Conventions Used in This Book
    9. Using Code Examples
    10. Safari® Books Online
    11. How to Contact Us
    12. Acknowledgments
  2. 1. Making the Transition from .NET (Part 1)
    1. Why WinRT?
    2. Philosophical Differences
    3. Objectives
    4. The New Project Templates
      1. WinRT Metadata
      2. Project Settings and Adding References
    5. Building a Basic User Interface
      1. UI Tracks
        1. HTML
        2. Better experience
      2. XAML Parsing Basics
      3. Building a Basic Page
      4. Implementing MVVM
      5. WPF and Silverlight
      6. MVVM Structure and Inversion of Control
        1. RegisterPageViewModel
        2. Handling errors
        3. Basic alerts
      7. Creating the View-Model and Running the App
        1. IViewModelHost
        2. Building out the DoRegistration method
        3. Running the application
  3. 2. Making the Transition from .NET (Part 2)
    1. Inversion of Control
      1. Installing TinyIoC
      2. Initializing IoC Defaults
    2. Understanding Asynchrony
      1. How Asynchrony Works in WinRT
        1. State machines
        2. Returning “void”
        3. The trick of asynchrony
    3. Calling the Server
      1. Building the Service Proxies
        1. Server protocol
      2. Building the Register Method
      3. Finishing the UI to Call the Register Server Function
    4. Logon
      1. Building LogonServiceProxy
      2. Building the Logon Page
    5. Busy Indicators
      1. Positioning the Indicator
      2. Showing the Indicator
  4. 3. Local Persistent Data
    1. SQLite and sqlite-net
    2. Working with SQLite
      1. A Primer on Object-Relational Mapping
      2. Using the Micro-ORM in sqlite-net
    3. Storing Settings
      1. The SettingItem Class
      2. Linking in sqlite-net
      3. Creating the Database Table for SettingItem
      4. Reading and Writing Values
        1. SetValueAsync
        2. GetValueAsync
      5. Modifying LogonPageViewModel
    4. Caching Data Locally
      1. Local Caching
      2. Mapping JSON to Database Entities
      3. Creating Test Reports
      4. Setting Up the User Database
      5. Creating ReportsPage
      6. Using Templates
      7. Building a Local Cache
      8. Updating the Cache
      9. Returning Reports from the Server
      10. The Items Property
  5. 4. The App Bar
    1. Adding a Simple App Bar
      1. Getting Started with an App Bar
    2. App Bar Behavior
      1. App Bar with Single-Select Grid
      2. App Bar with Multiselect Grid
    3. A More Complex App Bar Implementation
      1. Showing the App Bar on Multiple Selections
      2. Checking Touch Operations
      3. Showing the App Bar on Right-Click
      4. Showing Context Options
    4. App Bar Images
      1. The Glyph Method
      2. Using Images
        1. Styles in XAML
        2. Creating images for app bar buttons
        3. Creating a template that uses an image
  6. 5. Notifications
    1. Local Notifications
      1. Turning Notifications On and Off
      2. XML Templates
      3. Toast
        1. Setting permissions
        2. Toast without an image
        3. Toast with an image
        4. Asynchrony and notifications
      4. Badges
      5. Tiles
        1. Tile template types
        2. Creating a wide tile
        3. Creating TileNotificationBuilder
      6. Other Notification Features
    2. Push Notifications
      1. WNS Process
      2. Handling User Accounts
      3. Obtaining a Notification URI
      4. Sending to WNS
        1. Registering the app
        2. Authenticating
        3. Sending
      5. Troubleshooting Tips
  7. 6. Working with Files
    1. The File Picker
    2. File Associations
      1. Launching the App
      2. Handling the Launch
    3. Sandboxed File Access
      1. Walking and Copying Pictures
    4. Roaming Files
      1. Multiple Devices
      2. Setting Up the Remote Debugging Client
      3. Syncing Files
      4. Roaming Settings
    5. Using Files with StreetFoo
      1. Getting Report Images
      2. Migrating to ReportViewItem
        1. Refactoring to ReportViewItem
        2. Modifying the grid item template
      3. Implementing ReportImageCacheManager
        1. Checking for file existence
        2. Downloading and caching images
  8. 7. Sharing
    1. Sharing Data
      1. Basic Sharing
        1. Hooking the DataTransferManager into the view-model
        2. Sharing basic data
        3. Sharing images
        4. Sharing other types of data
      2. Pull Requests/Deferrals
    2. Acting as a Share Target
      1. Sharing Text
      2. Sharing Text (and Troubleshooting)
        1. Migrating ShareTargetPage to MVVM
        2. Tracking debug information
        3. Debugging share operations
        4. Fixing the runtime startup problem
        5. Handling shared text
      3. Long-Running Operations
      4. Sharing Images
        1. Configuring the manifest
        2. Reading image data
        3. Testing sharing an image via GetBitmapAsync
    3. Quick Links
  9. 8. Searching
    1. Implementing Search
      1. Creating the Search Results Page
      2. Creating SearchResultsPageViewModel
      3. Implementing the Search Operation
        1. Searching SQLite
        2. The search routine proper
        3. Adjusting the presentation
        4. Handling item clicks on the grid
    2. Refining Search
      1. Placeholder Text
      2. Suggestions
        1. Finding suggestions
        2. Finding recommendations
      3. Remembering Where We Were
      4. Using the SearchBox
      5. Other Best-Practice Notes
  10. 9. Settings
    1. Adding Options
      1. Standard Options
      2. Adding Custom Options
    2. Implementing the Settings Flyout
      1. Building a Settings Pane
      2. Building MySettingsFlyout
    3. Developing a Help Screen
      1. Creating a Help Pane
      2. Handling the F1 Key
      3. Rendering Markup
  11. 10. Location
    1. Creating a Singleton View
      1. Creating the View-Model
      2. Creating the View
      3. Navigating to the View
    2. Retrieving a Current Location
      1. Using the Simulator with Location
    3. Integrating Maps
      1. Adding the Bing Maps Control
      2. Handling Input with the View
      3. Packaging Points for Display
      4. Showing Points on the Map
    4. Shelling to the Maps App
  12. 11. Using the Camera
    1. Capturing Photos
    2. Creating EditReportPage
      1. Building EditReportPageViewModel and Its View-Model
    3. Saving and Canceling
    4. Adding the New Option
    5. Handling Temporary Files
      1. Changing the Manifest
      2. Taking Pictures
    6. Implementing Save
      1. Validating and Saving
      2. Resizing Images
  13. 12. Responsive Design
    1. Updating the Grid View
      1. The VisualStateManager
    2. Creating MyListView
    3. Modifying the App Bar
    4. Updating Singleton Views
      1. Adding a More Button to the App Bar
    5. Handling Views That Don’t Support 320-Pixel Width
  14. 13. Resources and Localization
    1. .pri Files
      1. Adding Strings
    2. Localizing Strings
      1. Default Project Locales
      2. Localizing Strings in XAML
      3. Conventions
      4. Changing Other Properties
      5. Explicitly Loading Strings
    3. Localizing Images
      1. Varying Images by Locale
      2. Varying Images by Display DPI
  15. 14. Background Tasks and App Lifetime
    1. App Lifetime
    2. Background Tasks API
      1. CPU Usage Quota
        1. Network constraints
      2. Triggers and Conditions
    3. Execution Model
    4. Implementing a Sync Background Task
      1. Building the Façade
      2. Debugging the Task
      3. Troubleshooting Background Tasks
      4. Restricting the Run Period
    5. Implementing the Sync Function
      1. Sending Changes
      2. Receiving New Work
      3. Signaling the App from the Background Task
      4. Putting the App on the Lock Screen
  16. 15. Sideloading and Distribution
    1. Using the Windows App Certification Kit
    2. Distribution Through Production Sideloading
      1. Turning on Sideloading on Windows 8
      2. Installing Apps
    3. Distribution Through the Windows Store
  17. A. Cryptography and Hashing
    1. SSL
    2. Device Security
    3. SQLite
    4. Hashing
    5. Generating Random Data
    6. Symmetric Encryption
  18. B. Unit Testing Basics for Windows Store Apps
    1. Unit Testing for Newbies
    2. Creating a Test Project
    3. Testing RegisterServiceProxy
    4. Starting the Runtime and Handling async Methods
    5. Testing the View-Models
  19. Index
  20. Colophon
  21. Copyright