Windows® 8.1 Apps with HTML5 and JavaScript Unleashed

Book description

Take advantage of your existing JavaScript and HTML skills to build apps for Windows 8.1 and add them to the Windows Store. It’s a remarkable opportunity—and best-selling Microsoft web development author Stephen Walther will show you how to take full advantage of it.

Offering the same deep insight and practical code that has made his ASP.NET Unleashed the #1 ASP.NET book of all time, Walther covers everything you need to build outstanding Windows Store apps with JavaScript and HTML5.

He guides you through using Microsoft’s WinJS 2.0 library to develop apps for Windows 8.1—you learn how to use JavaScript templates, controls, and data binding. You’ll find in-depth coverage of everything from displaying data with a ListView control to supporting SkyDrive cloud storage, creating games to using IndexedDB and HTML5 forms.

Extensively updated for the release of Windows 8.1, this book covers all of the new features of the WinJS 2.0 library such as the Repeater, SearchBox, WebView, and NavBar controls and the new WinJS Scheduler. This book has been updated with a new sample app that demonstrates how to build a Windows Store app that interacts with Windows Azure Mobile Services.

If you’re a web developer, Windows 8 gives you millions of new potential customers to buy your apps—and you already have many of the skills you’ll need to reach them. Get this book, master the tools and techniques you don’t already know—and go after that huge new market!

Detailed information on how to…

  • Get your app published in the Windows Store

  • Use JavaScript controls such as the Tooltip, Rating, DatePicker, and FlipView controls

  • Thoroughly master using the WinJS ListView control to display, sort, and filter data

  • Use new controls introduced with Windows 8.1 such as the Repeater, WebView, NavBar, and SearchBox controls

  • Implement Windows Search and Share contracts

  • Use HTML5 Canvas to build arcade games

  • Store data on the local file system, via Windows Azure Mobile Services or in IndexedDB databases

  • Use Live Services to authenticate users, retrieve user profiles, and interact with SkyDrive

  • Create custom WinJS controls with Page Controls

  • Build apps that gracefully adapt to different screen resolutions and orientations

  • Take pictures from your computer’s webcam and play sounds 8.1 Apps

  • Table of contents

    1. About This eBook
    2. Title Page
    3. Copyright Page
    4. Contents at a Glance
    5. Table of Contents
    6. About the Author
    7. Dedication
    8. Acknowledgments
    9. We Want to Hear from You!
    10. Reader Services
    11. Introduction
      1. Updated for Windows 8.1
      2. Prerequisites for This Book
      3. Source Code
    12. Chapter 1. Building Windows Store Apps
      1. What Is a Windows Store App?
        1. Microsoft Design Style Principles
        2. Common Features of Windows Store Apps
      2. Creating Your First Windows Store App
        1. Creating the Visual Studio Project
        2. Declaring App Capabilities
        3. Creating the HTML Page
        4. Creating the Style Sheet
        5. Creating the JavaScript File
        6. Running the App
      3. Elements of a Windows Store App
        1. JavaScript
        2. HTML5
        3. Cascading Style Sheets 3
        4. Windows Runtime
        5. Windows Library for JavaScript
        6. What About jQuery?
      4. Building Windows Store Apps with Visual Studio
        1. Windows Store App Project Templates
        2. Running a Windows Store App
      5. Debugging a Windows Store App
        1. Using the Visual Studio JavaScript Console Window
        2. Setting Breakpoints
        3. Using the DOM Explorer
      6. Publishing to the Windows Store
        1. Register as a Windows Developer
        2. Submitting Your App
        3. Passing App Certification
      7. Migrating from Windows 8 to Windows 8.1
      8. Summary
    13. Chapter 2. WinJS Fundamentals
      1. Namespaces, Modules, and Classes
        1. Using Namespaces
        2. Using the Module Pattern
        3. Using Classes
      2. Asynchronous Programming with Promises
        1. Using Promises
        2. Using then() Versus done()
        3. Creating Promises
        4. Creating a Timeout Promise
        5. Canceling Promises
        6. Composing Promises
      3. Retrieving DOM Elements with Query Selectors
        1. Performing Queries with the WinJS.Utilities.query() Method
        2. Retrieving a Single Element with the WinJS.Utilities.id() Method
        3. Using the WinJS.Utilities.children() method
        4. Working with the QueryCollection Class
      4. Performing Ajax Calls with the xhr Function
        1. Specifying Different Response Types
        2. Customizing the Properties of the XmlHttpRequest Object
      5. Using the Scheduler to Prioritize Jobs
        1. Setting Job Priorities
        2. Yielding to a Higher Priority Job
      6. Summary
    14. Chapter 3. Observables, Bindings, and Templates
      1. Understanding Observables
        1. Creating an Observable
        2. Creating Observable Listeners
        3. Coalescing Notifications
        4. Bypassing Notifications
        5. Working with the WinJS.Binding.List Object
        6. Creating an Observable Collection of Observables
      2. Understanding Declarative Data Binding
        1. Declarative Data Binding and Observables
        2. Capturing the Contents of an HTML Form
        3. Declarative Data Binding and WinJS Controls
        4. Declarative Data Binding and Binding Converters
      3. Understanding Templates
        1. Creating an Imperative Template
        2. Creating a Declarative Template
        3. Applying a Template with a Query Selector
        4. Creating External Templates
      4. Summary
    15. Chapter 4. Using WinJS Controls
      1. Introduction to WinJS Controls
        1. Creating a WinJS Control Declaratively
        2. Creating Controls Imperatively
        3. Setting Control Options
        4. Retrieving Controls from an HTML Document
      2. Using the Tooltip Control
        1. Using the contentElement Property
        2. Styling a Tooltip
      3. Using the ToggleSwitch Control
        1. Determining the State of a ToggleSwitch
      4. Using the Rating Control
        1. Customizing the Ratings
        2. Submitting a Rating
      5. Using the DatePicker Control
        1. Formatting the Year, Month, and Date
        2. Displaying Only Years, Months, or Days
        3. Capturing the Selected Date
      6. Using the TimePicker Control
        1. Getting and Setting the Current Time
        2. Formatting the Hour, Minute, and Period
      7. Using the Hub Control
        1. Creating Hubs and Hub Sections
        2. Handling Hub Section Navigation
      8. Using the WebView Control
        1. Hosting a Page from the Internet with the WebView Control
        2. Handling Navigation and Navigation Events
        3. Capturing WebView Screenshots
      9. Summary
    16. Chapter 5. Creating Forms
      1. Using HTML5 Form Validation
        1. Using the required Attribute
        2. Using the pattern Attribute
        3. Performing Custom Validation
        4. Customizing the Validation Error Style
        5. Resetting a Form
      2. Using HTML5 Input Elements
        1. Labeling Form Fields
        2. Entering a Number
        3. Entering a Value from a Range of Values
        4. Entering Email Addresses, URLs, Telephone Numbers, and Search Terms
        5. Entering a Value from a List of Values
        6. Selecting Files
      3. Creating a Rich Text Editor
      4. Displaying Progress
      5. Summary
    17. Chapter 6. Menus and Flyouts
      1. Using the Flyout Control
      2. Using the Menu Control
      3. Using the AppBar Control
        1. Creating a Simple App Bar
        2. Using App Bar Commands
        3. Showing Contextual Commands
      4. Using the NavBar Control
        1. Creating a Simple Nav Bar
      5. Configuring App Settings
        1. Creating About Page Settings
        2. Creating Personal Settings
      6. Displaying Windows Dialogs
      7. Summary
    18. Chapter 7. Using the ItemContainer, Repeater, and FlipView Controls
      1. Using the ItemContainer Control
        1. Styling an ItemContainer
        2. Interacting with an ItemContainer
        3. Selecting an ItemContainer
        4. Creating Drag-and-Drop Items
      2. Using the Repeater Control
        1. Using an External Template
        2. Using a Nested Template
        3. Using the Repeater with the ItemContainer
      3. Using the FlipView Control
        1. Displaying Page Numbers
        2. Creating Custom FlipView Buttons
      4. Summary
    19. Chapter 8. Using the ListView Control
      1. Introduction to the ListView Control
      2. Using Different ListView Layouts
        1. Using Grid Layout
        2. Using List Layout
        3. Using Cell Spanning Layout
      3. Invoking Items in a ListView Control
      4. Selecting Items in a ListView Control
      5. Sorting Items in a ListView Control
      6. Filtering Items in a ListView Control
      7. Grouping Items in a ListView Control
      8. Switching Views with Semantic Zoom
      9. Switching a ListView Template Dynamically
      10. Using Drag and Drop
        1. Reordering Items in a ListView
        2. Dragging Items from ListViews
      11. Summary
    20. Chapter 9. Creating Data Sources
      1. Creating Custom Data Sources
        1. Creating the Data Source Class
        2. Creating a Data Adapter
        3. Implementing the getCount() Method
        4. Implementing the itemsFromIndex() Method
        5. Implementing the insertAtEnd() Method
        6. Implementing the remove() Method
        7. Implementing the change() Method
        8. Handling Errors
        9. Implementing the setNotificationHandler() Method
      2. Creating a File Data Source
        1. Using the File Data Source
      3. Creating a Web Service Data Source
        1. Creating the Data Source
        2. Creating the Web Service
        3. Using the Web Service Data Source
      4. Creating an IndexedDB Data Source
        1. Overview of IndexedDB
        2. Using the IndexedDB Data Source
      5. Summary
    21. Chapter 10. Using Windows Azure Mobile Services
      1. Creating a Mobile Service
      2. Creating a Database Table
      3. Installing the Mobile Services for WinJS Library
      4. Performing Inserts, Updates, and Deletes
        1. Connecting to the Remote Database Table
        2. Inserting Database Data
        3. Updating Database Data
        4. Deleting Database Data
      5. Performing Database Queries
        1. Looking Up a Single Database Record
        2. Retrieving a Set of Database Records
      6. Performing Validation
      7. Performing Custom Actions
      8. Debugging Script Errors
      9. Summary
    22. Chapter 11. App Events and States
      1. App Events
        1. Handling the Activated Event
        2. Handling the Error Event
        3. Deferring Events with Promises
        4. Creating Custom Events
      2. Suspending, Terminating, and Resuming an App
        1. Detecting When an App Is Suspended and Terminated
        2. Detecting the Previous Execution State
        3. Testing Application State with Visual Studio
        4. Storing State with Session State
      3. Designing for Different Window Sizes
        1. Setting the Minimum App Width
        2. Using CSS Media Queries
        3. Using the window resize Event
      4. Scaling Content to Fit Different Screen Resolutions
        1. Defining a Viewport
        2. Using the ViewBox Control
      5. Summary
    23. Chapter 12. Page Fragments and Navigation
      1. Using the HtmlControl Control
      2. Creating a Page Control
      3. Creating Multi-Page Apps
        1. Creating a Navigation App
        2. Understanding the Navigation App default.html Page
        3. Adding New Page Controls to a Navigation App
        4. Navigating to Another Page
        5. Understanding the Navigation API
        6. Understanding the PageControlNavigator Control
        7. Understanding Navigation State
      4. Summary
    24. Chapter 13. Creating Share and Search Contracts
      1. Supporting Sharing
        1. Creating a Share Source
        2. Creating a Share Target
      2. Using the Search Charm
        1. Declaring Your App as a Search Provider
        2. Providing Search Suggestions
        3. Handling Search Activation
        4. Adding a Search Results Page
      3. Using the SearchBox Control
        1. Adding the SearchBox Control to a Page
        2. Providing Search Suggestions
        3. Displaying Search Results
      4. Using the Windows Content Indexer
        1. Understanding the Windows Content Indexer API
        2. Creating an Indexer Helper
        3. Using the Indexer Helper
      5. Summary
    25. Chapter 14. Using the Live Connect API
      1. Installing the Live SDK
        1. Adding a Reference to the Live SDK
        2. Registering Your App
        3. Initializing the Live Connect SDK
        4. Specifying Different Scopes
      2. Authenticating a User
        1. Logging a User into Live Connect
        2. Creating Account Settings
      3. Authentication and Windows Azure Mobile Services
        1. Configuring Your Mobile Service
        2. Setting Permissions for Your Mobile Service
        3. Updating the Mobile Server Scripts
        4. Logging Into Azure Mobile Services
      4. Retrieving Basic User Information
      5. Uploading and Downloading Files from SkyDrive
        1. Listing SkyDrive Folders and Files
        2. Downloading Files from SkyDrive
        3. Uploading Files to SkyDrive
      6. Summary
    26. Chapter 15. Graphics and Games
      1. Overview of the Game
      2. Creating the Game Tiles
      3. Playing the Game Sounds
      4. Creating the Game Canvas
      5. Capturing User Interaction
      6. Creating the Update Loop
      7. Creating the Render Loop
      8. Summary
    27. Chapter 16. Creating a Task List App
      1. Overview of the App
      2. Setting Up the App
      3. Connecting to External Services
      4. Optimistic Inserts, Updates, and Deletes
      5. Adapting to Screen Changes
      6. Creating a Custom Control
      7. Using Text to Speech
      8. Summary
    28. Index

    Product information

    • Title: Windows® 8.1 Apps with HTML5 and JavaScript Unleashed
    • Author(s): Stephen Walther
    • Release date: December 2013
    • Publisher(s): Sams
    • ISBN: 9780133761238