Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Copyright Page
Table of Contents
Introduction
Who This Book Is For
What You'll Need (Can You Say “Samples”?)
A Formatting Note
Acknowledgements
Free Ebooks from Microsoft Press
The “Microsoft Press Guided Tours” App
Errata & Book Support
We Want to Hear from You
Stay in Touch
Chapter 1 The Life Story of a Windows Store App: Characteristics of the Windows Platform
Leaving Home: Onboarding to the Windows Store
Discovery, Acquisition, and Installation
Playing in Your Own Room: The App Container
Different Views of Life: Views and Resolution Scaling
Those Capabilities Again: Getting to Data and Devices
Taking a Break, Getting Some Rest: Process Lifecycle Management
Remembering Yourself: App State and Roaming
Coming Back Home: Updates and New Opportunities
And, Oh Yes, Then There’s Design
Feature Roadmap and Cross-Reference
Chapter 2 Quickstart
A Really Quick Quickstart: The Blank App Template
Blank App Project Structure
QuickStart #1: Here My Am! and an Introduction to Blend for Visual Studio
Design Wireframes
Create the Markup
Styling in Blend
Adding the Code
Extra Credit: Improving the App
Receiving Messages from the iframe
Improving the Placeholder Image with a Canvas Element
Handling Variable Image Sizes
Moving the Captured Image to AppData (or the Pictures Library)
Using a Thumbnail Instead of the Full Image
The Other Templates: Projects and Items
Navigation App Template
Grid App Template
Hub App Template
Split Template
Item Templates
What We’ve Just Learned
Chapter 3 App Anatomy and Performance Fundamentals
App Activation
Branding Your App 101: The Splash Screen and Other Visuals
Activation Event Sequence
Activation Code Paths
WinJS.Application Events
Optimizing Startup Time
WinRT Events and removeEventListener
App Lifecycle Transition Events and Session State
Suspend, Resume, and Terminate
Basic Session State in Here My Am!
Page Controls and Navigation
WinJS Tools for Pages and Page Navigation
The Navigation App Template, PageControl Structure, and PageControlNavigator
The Navigation Process and Navigation Styles
Optimizing Page Switching: Show-and-Hide
Page-Specific Styling
Async Operations: Be True to Your Promises
Using Promises
Joining Parallel Promises
Sequential Promises: Nesting and Chaining
Managing the UI Thread with the WinJS Scheduler
Scheduler Priorities
Scheduling and Managing Tasks
Setting Priority in Promise Chains
Long-Running Tasks
Debugging and Profiling
Debug Output and Logging
Error Reports and the Event Viewer
Async Debugging
Performance and Memory Analysis
The Windows App Certification Toolkit
What We’ve Just Learned
Chapter 4 Web Content and Services
Network Information and Connectivity
Network Types in the Manifest
Network Information (the Network Object Roster)
The ConnectionProfile Object
Connectivity Events
Cost Awareness
Running Offline
Hosting Content: the WebView and iframe Elements
Local and Web Contexts (and iframe Elements)
Dynamic Content
App Content URIs
The <x-ms-webview> Element
HTTP Requests
Using WinJS.xhr
Using Windows.Web.Http.HttpClient
Suspend and Resume with Online Content
Prefetching Content
Background Transfer
Basic Downloads
Basic Uploads
Completion and Error Notifications
Providing Headers and Credentials
Setting Cost Policy
Grouping Transfers
Suspend, Resume, and Restart with Background Transfers
Authentication, the Microsoft Account, and the User Profile
The Credential Locker
The Web Authentication Broker
Single Sign-On
Using the Microsoft Account
The User Profile (and the Lock Screen Image)
What We’ve Just Learned
Chapter 5 Controls and Control Styling
The Control Model for HTML, CSS, and JavaScript
HTML Controls
Extensions to HTML Elements
WinJS Controls
Syntax for data-win-options
WinJS Control Instantiation
Strict Processing and processAll Functions
Example: WinJS.UI.HtmlControl
Example: WinJS.UI.Rating (and Other Simple Controls)
Example: WinJS.UI.Tooltip
Example: WinJS.UI.ItemContainer
Working with Controls in Blend
Control Styling
Styling Gallery: HTML Controls
Styling Gallery: WinJS Controls
Some Tips and Tricks
Custom Controls
Implementing the Dispose Pattern
Custom Control Examples
Custom Controls in Blend
What We’ve Just Learned
Chapter 6 Data Binding, Templates, and Collections
Data Binding
Data Binding Basics
Data Binding in WinJS
Under the Covers: Binding mixins
Programmatic Binding and WinJS.Binding.bind
Binding Initializers
Binding Templates
Template Options, Properties, and Compilation
Collection Data Types
Windows.Foundation.Collection Types
WinJS Binding Lists
What We’ve Just Learned
Chapter 7 Collection Controls
Collection Control Basics
Quickstart #1: The WinJS Repeater Control with HTML controls
Quickstart #2: The FlipView Control Sample
Quickstart #3: The ListView Essentials Sample
Quickstart #4: The ListView Grouping Sample
ListView in the Grid App Project Template
The Semantic Zoom Control
How Templates Work with Collection Controls
Referring to Templates
Template Functions (Part 1): The Basics
Creating Templates from Data Sources in Blend
Repeater Features and Styling
FlipView Features and Styling
Collection Control Data Sources
The Structure of Data Sources (Interfaces Aplenty!)
A FlipView Using the Pictures Library
Custom Data Sources and WinJS.UI.VirtualizedDataSource
ListView Features and Styling
When Is ListView the Right Choice?
Options, Selections, and Item Methods
Styling
Loading State Transitions
Drag and Drop
Layouts
Template Functions (Part 2): Optimizing Item Rendering
What We’ve Just Learned
Chapter 8 Layout and Views
Principles of PageLayout
Sizing, Scaling, and Views: The Many Faces of Your App
Variable View Sizing and Orientations
Screen Resolution, Pixel Density, and Scaling
Multiple Views
Pannable Sections and Styles
Laying Out the Hub
Laying Out the Sections
Panning Styles and Railing
Panning Snap Points and Limits
Zooming Snap Points and Limits
The Hub Control and Hub App Template
Hub Control Styling
Using the CSS Grid
Overflowing a Grid Cell
Centering Content Vertically
Scaling Font Size
Item Layout
CSS 2D and 3D Transforms
Flexbox
Nested and Inline Grids
Fonts and Text Overflow
Multicolumn Elements and Regions
What We’ve Just Learned
Chapter 9 Commanding UI
Where to Place Commands
The App Bar and Nav Bar
App Bar Basics and Standard Commands
App Bar Styling
Command Menus
Custom App Bars
Nav Bar Features
Nav Bar Styling
Flyouts and Menus
WinJS.UI.Flyout Properties, Methods, and Events
Flyout Examples
Menus and Menu Commands
Message Dialogs
Improving Error Handling in Here My Am!
What We’ve Just Learned
Chapter 10 The Story of State, Part 1: App Data and Settings
The Story of State
App Data Locations
App Data APIs (WinRT and WinJS)
Settings Containers
State Versioning
Folders, Files, and Streams
FileIO, PathIO, and WinJS Helpers (plus FileReader)
Encryption and Compression
Q&A on Files, Streams, Buffers, and Blobs
Using App Data APIs for State Management
Transient Session State
Local and Temporary State
IndexedDB, SQLite, and Other Database Options
Roaming State
Settings Pane and UI
Design Guidelines for Settings
Populating Commands
Implementing Commands: Links and Settings Flyouts
Programmatically Invoking Settings Flyouts
Here My Am! Update
What We’ve Just Learned
Chapter 11 The Story of State, Part 2: User Data, Files, and OneDrive
The Big Picture of User Data
Using the File Picker and Access Cache
The File Picker UI
The File Picker API
Access Cache
StorageFile Properties and Metadata
Availability
Thumbnails
File Properties
Media-Specific Properties
Folders and Folder Queries
KnownFolders and the StorageLibrary Object
Removable Storage
Simple Enumeration and Common Queries
Custom Queries
Metadata Prefetching with Queries
Creating Gallery Experiences
File Activation and Association
What We’ve Just Learned
Chapter 12 Input and Sensors
Touch, Mouse, and Stylus Input
The Touch Language and Mouse/Keyboard Equivalents
What Input Capabilities Are Present?
Unified Pointer Events
Gesture Events
The Gesture Recognizer
Keyboard Input and the Soft Keyboard
Soft Keyboard Appearance and Configuration
Adjusting Layout for the Soft Keyboard
Standard Keystrokes
Inking
Geolocation
Geofencing
Sensors
What We’ve Just Learned
Chapter 13 Media
Creating Media Elements
Graphics Elements: Img, Svg, and Canvas (and a Little CSS)
Additional Characteristics of Graphics Elements
Some Tips and Tricks
Rendering PDFs
Video Playback and Deferred Loading
Disabling Screen Savers and the Lock Screen During Playback
Video Element Extension APIs
Applying a Video Effect
Browsing Media Servers
Audio Playback and Mixing
Audio Element Extension APIs
Playback Manager and Background Audio
The Media Transport Control UI
Playing Sequential Audio
Playlists
Text to Speech
Loading and Manipulating Media
Image Manipulation and Encoding
Manipulating Audio and Video
Handling Custom Audio and Video Formats
Media Capture
Flexible Capture with the MediaCapture Object
Selecting a Media Capture Device
Streaming Media and Play To
Streaming from a Server and Digital Rights Management
Streaming from App to Network
Play To
What We Have Learned
Chapter 14 Purposeful Animations
Systemwide Enabling and Disabling of Animations
The WinJS Animations Library
Animations in Action
CSS Animations and Transitions
Designing Animations in Blend for Visual Studio
The HTML Independent Animations Sample
Rolling Your Own: Tips and Tricks
What We’ve Just Learned
Chapter 15 Contracts
Share
Share Source Apps
Share Target Apps
The Clipboard
Launching Apps with URI Scheme Associations
Search
The Search Charm UI
The WinJS.UI.SearchBox Control
Providing Query Suggestions
Providing Result Suggestions
SearchBox Styling
Indexing and Searching Content
The Search Contract
Contacts
Contact Cards
Using the Contact Picker
Appointments
What We’ve Just Learned
Chapter 16 Alive with Activity: Tiles, Notifications, the Lock Screen, and Background Tasks
Alive with Activity: A Visual Tour
The Four Sources of Updates and Notifications
Tiles, Secondary Tiles, and Badges
Secondary Tiles
Basic Tile Updates
Cycling, Scheduled, and Expiring Updates
Badge Updates
Periodic Updates
Creating an Update Service
Debugging a Service Using the Localhost
Windows Azure and Azure Mobile Services
Toast Notifications
Creating Basic Toasts
Butter and Jam: Options for Your Toast
Tea Time: Scheduled Toasts and Alarms
Toast Events and Activation
Push Notifications and the Windows Push Notification Service
Requesting and Caching a Channel URI (App)
Managing Channel URIs (Service)
Sending Updates and Notifications (Service)
Raw Notifications (Service)
Receiving Notifications (App)
Debugging Tips
Tools and Providers for Push Notifications
Background Tasks and Lock Screen Apps
Background Tasks in the Manifest
Building and Registering Background Tasks
Conditions
Tasks for Maintenance Triggers
Tasks for System Triggers (Non-Lock Screen)
Lock Screen–Dependent Tasks and Triggers
Debugging Background Tasks
What We’ve Just Learned (Whew!)
Chapter 17 Devices and Printing
Declaring Device Access
Enumerating and Watching Devices
Scenario API Devices
Image Scanners
Barcode and Magnetic Stripe Readers (Point-of-Service Devices)
Smartcards
Fingerprint (Biometric) Readers
Bluetooth Call Control
Printing Made Easy
The Printing User Experience
Print Document Sources
Providing Print Content and Configuring Options
Protocol APIs: HID, USB, Bluetooth, and Wi-Fi Direct
Human Interface Devices (HID)
Custom USB Devices
Bluetooth (RFCOMM)
Bluetooth Smart (LE/GATT)
Wi-Fi Direct
Near Field Communication and the Proximity API
Finding Your Peers (No Pressure!)
Sending One-Shot Payloads: Tap to Share
What We’ve Just Learned
Chapter 18 WinRT Components: An Introduction
Choosing a Mixed Language Approach (and Web Workers)
Quickstarts: Creating and Debugging Components
Quickstart #1: Creating a Component in C#
Simultaneously Debugging Script and Managed/Native Code
Quickstart #2: Creating a Component in C++
Comparing the Results
Key Concepts for WinRT Components
Implementing Asynchronous Methods
Projections into JavaScript
Scenarios for WinRT Components
Higher Performance (Perhaps)
Access to Additional APIs
Obfuscating Code and Protecting Intellectual Property
Concurrency
Library Components
What We’ve Just Learned
Chapter 19 Apps for Everyone, Part 1: Accessibility and World-Readiness
Accessibility
Screen Readers and Aria Attributes
Handling Contrast Variations
World Readiness and Localization
Globalization
Preparing for Localization
Creating Localized Resources: The Multilingual App Toolkit
Localization Wrap-Up
What We’ve Just Learned
Chapter 20 Apps for Everyone, Part 2: The Windows Store
Your App, Your Business
Planning: Can the App Be a Windows Store App?
Planning for Monetization (or Not)
Growing Your Customer Base and Other Value Exchanges
Measuring and Experimenting with Revenue Performance
The Windows Store APIs
The CurrentAppSimulator Object
Trial Versions and App Purchase
Listing and Purchasing In-App Products
Handling Large Catalogs
Receipts
Instrumenting Your App for Telemetry and Analytics
Releasing Your App to the World
Promotional Screenshots, Store Graphics, and Text Copy
Testing and Pre-Certification Tools
Creating the App Package
Onboarding and Working through Rejection
App Updates
Getting Known: Marketing, Discoverability, and the Web
Connecting Your Website and Web-Mapped Search Results
Face It: You’re Running a Business!
Look for Opportunities
Invest in Your Business
Fear Not the Marketing
Support Your Customers
Plan for the Future
Selling Your App When It’s Not Running
You’re Not Alone
Final Thoughts: Qualities of a Rock Star App
What We’ve Just Learned
Appendix A Demystifying Promises
What Is a Promise, Exactly? The Promise Relationships
The Promise Construct (Core Relationship)
Example #1: An Empty Promise!
Example #2: An Empty Async Promise
Example #3: Retrieving Data from a URI
Benefits of Promises
The Full Promise Construct
Nesting Promises
Chaining Promises
Promises in WinJS (Thank You, Microsoft!)
The WinJS.Promise Class
Originating Errors with WinJS.Promise.WrapError
Some Interesting Promise Code
Delivering a Value in the Future: WinJS.Promise.timeout
Internals of WinJS.Promise.timeout
Parallel Requests to a List of URIs
Parallel Promises with Sequential Results
Constructing a Sequential Promise Chain from an Array
PageControlNavigator._navigating (Page Control Rendering)
Bonus: Deconstructing the ListView Batching Renderer
Appendix B WinJS Extras
Exploring WinJS.Class Patterns
WinJS.Class.define
WinJS.Class.derive
Mixins
Obscure WinJS Features
Wrappers for Common DOM Operations
WinJS.Utilities.data, convertToPixels, and Other Positional Methods
WinJS.Utilities.empty, eventWithinElement, and getMember
WinJS.UI.scopedSelect and getItemsFromRanges
Extended Splash Screens
Adjustments for View Sizes
Custom Layouts for the ListView Control
Minimal Vertical Layout
Minimal Horizontal Layout
Two-Dimensional and Nonlinear Layouts
Virtualization
Grouping
The Other Stuff
Appendix C Additional Networking Topics
XMLHttpRequest and WinJS.xhr
Tips and Tricks for WinJS.xhr
Breaking Up Large Files (Background Transfer API)
Multipart Uploads (Background Transfer API)
Notes on Encryption, Decryption, Data Protection, and Certificates
Syndication: RSS, AtomPub, and XML APIs in WinRT
Reading RSS Feeds
Using AtomPub
Sockets
Datagram Sockets
Stream Sockets
Web Sockets: MessageWebSocket and StreamWebSocket
The ControlChannelTrigger Background Task
The Credential Picker UI
Other Networking SDK Samples
Appendix D Provider-Side Contracts
File Picker Providers
Manifest Declarations
Activation of a File Picker Provider
Cached File Updater
Updating a Local File: UI
Updating a Remote File: UI
Update Events
Contact Cards Action Providers
Contact Picker Providers
Appointment Providers
About the Author
← Prev
Back
Next →
← Prev
Back
Next →