You are previewing Windows 10 Development Recipes: A Problem-Solution Approach in HTML and JavaScript.
O'Reilly logo
Windows 10 Development Recipes: A Problem-Solution Approach in HTML and JavaScript

Book Description

This book is a practical guide to solving the everyday problems encountered when building apps for Windows 10 devices, including desktops, laptops, tablets, and phones, using HTML5, CSS3 and JavaScript.

Each recipe includes a concise statement of the problem and the approach you should take in order to solve it. A full code solution is also given, along with an in-depth explanation, so you can build on your development knowledge while you work on your application.

The majority of recipes can be used with the Universal Windows app template, designed to help you build one consistent user experience across devices. These are supplemented with recipes for adapting your app to different devices, screen sizes and sensor availability. You'll also find out how to deploy and publish your apps in the Windows Store.

Table of Contents

  1. Cover
  2. Title
  3. Copyright
  4. Dedication
  5. Contents at a Glance
  6. Contents
  7. About the Authors
  8. About the Technical Reviewer
  9. Acknowledgments
  10. Introduction
  11. Chapter 1 : Getting Started with Windows 10 Applications
    1. 1.1 Examining the Universal Windows Platform
      1. Problem
      2. Solution
    2. 1.2 Development Tools for Universal Windows Platform
      1. Problem
      2. Solution
    3. 1.3 Creating Universal Windows Platform Application
      1. Problem
      2. Solution
      3. How It Works
    4. 1.4 Running Universal Windows Platform Apps
      1. Problem
      2. Solution
      3. How It Works
  12. Chapter 2 : WinJS Fundamentals
    1. 2.1 Namespaces in JavaScript
      1. Problem
      2. Solution
      3. How It Works
    2. 2.2 Add a Namespace to an Existing Namespace
      1. Problem
      2. Solution
      3. How It works
    3. 2.3 Creating a Class in WinJS
      1. Problem
      2. Solution
      3. How It Works
    4. 2.4 Deriving a Class in WinJS
      1. Problem
      2. Solution
      3. How It Works
    5. 2.5 Create Mixins in WinJS
      1. Problem
      2. Solution
      3. How It Works
    6. 2.6 Encapsulation in WinJS
      1. Problem
      2. Solution
      3. How It Works
    7. 2.7 Using Promise in WinJS
      1. Problem
      2. Solution
      3. How It Works
  13. Chapter 3 : Basic WinJS Controls
    1. 3.1 Declaring a WinJS Control on a Page
      1. Problem
      2. Solution
      3. How It Works
    2. 3.2 Setting Options for WinJS Controls
      1. Problem
      2. Solution
      3. How It Works
    3. 3.3 Adding WinJS Controls from Your JavaScript Code
      1. Problem
      2. Solution
      3. How It Works
    4. 3.4 Getting the WinJS Controls from an HTML Document
      1. Problem
      2. Solution
      3. How It Works
    5. 3.5 The ToggleSwitch Control
      1. Problem
      2. Solution
      3. How It Works
    6. 3.6 The DatePicker Control
      1. Problem
      2. Solution
      3. How It Works
    7. 3.7 The TimePicker Control
      1. Problem
      2. Solution
      3. How It Works
    8. 3.8 The Tooltip Control
      1. Problem
      2. Solution
      3. How It Works
    9. 3.9 Displaying Text
      1. Problem
      2. Solution
      3. How It Works
    10. 3.10 Editing Text in an App
      1. Problem
      2. Solution
      3. How It Works
  14. Chapter 4 : List Controls, AppBar, and ToolBar
    1. 4.1 Using the Repeater Control
      1. Problem
      2. Solution
      3. How It Works
    2. 4.2 Using the FlipView Control
      1. Problem
      2. Solution
      3. How It Works
    3. 4.3 Using the ListView Control
      1. Problem
      2. Solution
      3. How It Works
    4. 4.4 Filtering Items in the ListView Control
      1. Problem
      2. Solution
      3. How It Works
    5. 4.5 Grouping Items in the ListView Control
      1. Problem
      2. Solution
      3. How It Works
    6. 4.6 Semantic Zoom in ListView
      1. Problem
      2. Solution
      3. How It Works
    7. 4.7 Using the AppBar Control
      1. Problem
      2. Solution
      3. How It Works
    8. 4.8 Using the ToolBar Control
      1. Problem
      2. Solution
      3. How It Works
  15. Chapter 5 : Data Binding and Navigation
    1. 5.1 Data Bind to Simple Objects
      1. Problem
      2. Solution
      3. How It Works
    2. 5.2 Data Bind Style Attributes of DOM Elements
      1. Problem
      2. Solution
      3. How It Works
    3. 5.3 Use Templates for Data Binding
      1. Problem
      2. Solution
      3. How It Works
    4. 5.4 Data Bind WinJS Controls
      1. Problem
      2. Solution
      3. How It Works
    5. 5.5 Navigational Structures in UWP Apps
      1. Problem
      2. Solution
    6. 5.6 Navigational Elements in UWP Apps
      1. Problem
      2. Solution
    7. 5.7 Pivot Navigation in UWP Apps
      1. Problem
      2. Solution
      3. How It Works
    8. 5.8 SplitView Navigation in UWP Apps
      1. Problem
      2. Solution
      3. How It Works
    9. 5.9 Hub Navigation in UWP Apps
      1. Problem
      2. Solution
      3. How It Works
    10. 5.10 Master/Detail Navigation Using ListView in UWP Apps
      1. Problem
      2. Solution
      3. How It Works
  16. Chapter 6 : Adapting the UI for Different Screens
    1. 6.1 Design Breakpoints for Different Screens
      1. Problem
      2. Solution
    2. 6.2 Adaptive UI Technique: Reposition
      1. Problem
      2. Solution
      3. How It Works
    3. 6.3 Adaptive UI Technique: Fluid Layouts
      1. Problem
      2. Solution
      3. How It Works
  17. Chapter 7 : Application Lifecycle and Navigation
    1. 7.1 Application States and Events
      1. Problem
      2. Solution
      3. How It Works
    2. 7.2 Handling the Unhandled Exception in Your App
      1. Problem
      2. Solution
      3. How It Works
    3. 7.3 Handling the Termination and Resuming of the App
      1. Problem
      2. Solution
      3. How It Works
    4. 7.4 Using SessionState to Store the State
      1. Problem
      2. Solution
      3. How It Works
    5. 7.5 Navigate Between Pages Using Hyperlinks
      1. Problem
      2. Solution
      3. How It Works
    6. 7.6 Navigate Between Pages Using Single-Page Navigation
      1. Problem
      2. Solution
      3. How It Works
  18. Chapter 8 : Globalization and Localization
    1. 8.1 Using Resource Strings
      1. Problem
      2. Solution
      3. How It Works
    2. 8.2 Formatting Date, Time, Number, and Currency
      1. Problem
      2. Solution
      3. How It Works
    3. 8.3 Localizing WinJS Controls
      1. Problem
      2. Solution
      3. How It Works
  19. Chapter 9 : Data Storage and App Data
    1. 9.1 How to Create and Delete a Local App Data Settings Container
      1. Problem
      2. Solution
      3. How It Works
    2. 9.2 How to Create and Read Local App Data Settings
      1. Problem
      2. Solution
      3. How It Works
    3. 9.3 How to Create and Retrieve Local Composite Settings
      1. Problem
      2. Solution
      3. How It Works
    4. 9.4 How to Create a Roaming App Data Store Container
      1. Problem
      2. Solution
      3. How It Works
    5. 9.5 How to Create and Read Roaming App Data Settings
      1. Problem
      2. Solution
      3. How It Works
    6. 9.6 How to Register the Data Change Event
      1. Problem
      2. Solution
      3. How It Works
    7. 9.7 How to Create, Write, and Read a Local File
      1. Problem
      2. Solution
      3. How It Works
  20. Chapter 10 : Sharing Data
    1. Share Contract
    2. 10.1 Set up an Event Handler for a Share Option for a Source App
      1. Problem
      2. Solution
      3. How It Works
    3. 10.2 Share Plain Text Data to Other Apps
      1. Problem
      2. Solution
      3. How It Works
    4. 10.3 Share Web Links to Other Apps
      1. Problem
      2. Solution
      3. How It Works
    5. 10.4 Share an Image to Other Apps
      1. Problem
      2. Solution
      3. How It Works
    6. 10.5 Declare App As a Share Target
      1. Problem
      2. Solution
      3. How It Works
    7. 10.6 Handle Share Activation and Receive Plain Text
      1. Problem
      2. Solution
      3. How It Works
    8. 10.7 Receive Images Shared by Other Apps
      1. Problem
      2. Solution
      3. How It Works
    9. 10.8 Share Custom Data Type
      1. Problem
      2. Solution
      3. How It Works
  21. Chapter 11 : Background Tasks
    1. 11.1 System Event Triggers for Background Tasks
      1. Problem
      2. Solution
    2. 11.2 Create and Register a Background Task
      1. Problem
      2. Solution
      3. How It Works
    3. 11.3 Setting Conditions for Running a Background Task
      1. Problem
      2. Solution
      3. How It Works
    4. 11.4 Monitor Background Task Progress and Completion
      1. Problem
      2. Solution
      3. How It Works
  22. Chapter 12 : Location and Maps in Windows Apps
    1. 12.1 Get the Current Location
      1. Problem
      2. Solution
      3. How It Works
    2. 12.2 Respond to Geolocator Location Updates
      1. Problem
      2. Solution
      3. How It Works
    3. 12.3 Detect the User’s Location with HTML5
      1. Problem
      2. Solution
      3. How It Works
    4. 12.4 Detect Location Updates with HTML5
      1. Problem
      2. Solution
      3. How It Works
    5. 12.5 Display Maps in the Built-in Maps App
      1. Problem
      2. Solution
      3. How It Works
    6. 12.6 Display Directions in the Built-in Maps App
      1. Problem
      2. Solution
      3. How It Works
    7. 12.7 Bing Maps Control in the Windows Store App
      1. Problem
      2. Solution
      3. How It Works
  23. Chapter 13 : Building Apps That Connect to the Cloud
    1. 13.1 Creating a New Mobile Service in Microsoft Azure
      1. Problem
      2. Solution
      3. How It Works
    2. 13.2 Creating a Database Table in Mobile Services
      1. Problem
      2. Solution
      3. How It Works
    3. 13.3 Installing Mobile Services for the WinJS Client Library
      1. Problem
      2. Solution
      3. How It Works
    4. 13.4 Performing the CRUD Operation
      1. Problem
      2. Solution
      3. How It Works
    5. 13.5 Data Retrieval with Paging
      1. Problem
      2. Solution
      3. How It Works
    6. 13.6 Sorting Returned Data from the Mobile Service
      1. Problem
      2. Solution
      3. How It Works
    7. 13.7 Performing Validation in a Server Script
      1. Problem
      2. Solution
      3. How It Works
  24. Chapter 14 : Tiles and Notifications
    1. 14.1 Create a Default Tile
      1. Problem
      2. Solution
      3. How It Works
    2. 14.2 Create Adaptive Tiles
      1. Problem
      2. Solution
      3. How It Works
    3. 14.3 Create a Toast Notification with Visual Content
      1. Problem
      2. Solution
      3. How It Works
    4. 14.4 Create a Toast Notification with Actions
      1. Problem
      2. Solution
      3. How It Works
    5. 14.5 Create a Scheduled Tile and Toast Notification
      1. Problem
      2. Solution
      3. How It Works
    6. 14.6 Create or Update a Badge on a Tile
      1. Problem
      2. Solution
      3. How It Works
  25. Chapter 15 : Device Capabilities
    1. 15.1 How to Specify Device Capabilities in an App Package Manifest
      1. Problem
      2. Solution
      3. How It Works
    2. 15.2 How to Specify Device Capabilities for Bluetooth for Windows Apps
      1. Problem
      2. Solution
      3. How It Works
    3. 15.3 How to Find Devices Available for a UWP App
      1. Problem
      2. Solution
      3. How It Works
    4. 15.4 How to Create an Audio Stream and Output Speech Based on Plain Text
      1. Problem
      2. Solution
      3. How It Works
    5. 15.5 How to Specify Recognition Constraints for Speech Recognition
      1. Problem
      2. Solution
      3. How It Works
    6. 15.6 How to Launch Your App with Cortana Voice Command in Foreground
      1. Problem
      2. Solution
      3. How It Works
  26. Chapter 16 : Additional Tools
    1. 16.1 JavaScript Console Window
      1. Problem
      2. Solution
      3. How It Works
    2. 16.2 DOM Explorer
      1. Problem
      2. Solution
      3. How It Works
    3. 16.3 Diagnostic Tools
      1. Problem
      2. Solution
      3. How It Works
    4. 16.4 Windows 10 Mobile Emulator: Additional Tools
      1. Problem
      2. Solution
      3. How It Works
  27. Chapter 17 : Sideloading and Windows App Certification Kit
    1. 17.1 Sideload Your App
      1. Problem
      2. Solution
      3. How It Works
    2. 17.2 Install Certificate and Package Separately
      1. Problem
      2. Solution
      3. How It Works
    3. 17.3 Validate Your Windows App Using the Windows App Certification Kit
      1. Problem
      2. Solution
      3. How It Works
    4. 17.4 Validate an App Package on a Remote Windows 10 Device
      1. Problem
      2. Solution
      3. How It Works
  28. Chapter 18 : Store and Monetization
    1. 18.1 Create a Windows App Developer Account
      1. Problem
      2. Solution
    2. 18.2 Package a Universal Windows Platform Application for Windows 10
      1. Problem
      2. Solution
      3. How It Works
    3. 18.3 Submit an App to the Windows Store
      1. Problem
      2. Solution
    4. 18.4 Use Windows Ad Mediation in Your UWP Apps
      1. Problem
      2. Solution
    5. 18.5 Show Ads in Your Application
      1. Problem
      2. Solution
  29. Index