ebook img

Windows 10 Development Recipes: A Problem-Solution Approach in HTML and JavaScript PDF

395 Pages·2016·10.863 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Windows 10 Development Recipes: A Problem-Solution Approach in HTML and JavaScript

K BOOKS FOR PROFESSIONALS BY PROFESSIONALS® u THE EXPERT’S VOICE IN WINDOWS 10 m a r · Windows 10 Development Recipes N a g a Windows 10 This book is a practical guide to solving the everyday problems encountered when building r apps for Windows 10 devices, including desktops, laptops, tablets, and phones, using HTML5, a j CSS3, and JavaScript. · R Each recipe includes a concise statement of the problem and the approach you should take in a w Development order to solve it. A full code solution is also given, along with an in-depth explanation, so you a can build on your development knowledge while you work on your application. l · R The majority of recipes can be used with the Universal Windows app template, designed to o help you build one consistent user experience across devices. These are supplemented with h Recipes recipes for adapting your app to diff erent devices, screen sizes, and sensor availability. You’ll i l l also fi nd out how to deploy and publish your apps in the Windows Store. a Learn how to: W • Make use of the latest Universal Windows app features, alongside customizations for i specifi c platforms and screen sizes n • Bring your apps to life with live tiles, notifi cations, and sharing d A Problem-Solution Approach in • Prepare your app to adapt to your users’ diff erent cultural and business environments o using globalization and localization APIs and best practices w • Understand the certifi cation process and publish your app to the Windows Store, HTML and JavaScript s with the option to pay once, install anywhere 1 — 0 This book is suitable for anyone developing for Windows and Windows Mobile. Readers should D be comfortable working with HTML and JavaScript. No previous experience with Microsoft Senthil Kumar technologies or languages is needed in order to use this book. e v Lohith Goudagere Nagaraj e l o Pathik Rawal p m Pryank Rohilla e n t R e c IISSBBNN 99787-81--14-84428-4027-200-7820-8Shelve in: i p Windows/General e User Level: s Intermediate 9 781484 207208 SOURCE CODE ONLINE www.apress.com Windows 10 Development Recipes A Problem-Solution Approach in HTML and JavaScript Senthil Kumar Lohith Goudagere Nagaraj Pathik Rawal Pryank Rohilla Windows 10 Development Recipes: A Problem-Solution Approach in HTML and JavaScript Copyright © 2016 by Senthil Kumar, Lohith Goudagere Nagaraj, Pathik Rawal, and Pryank Rohilla This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Exempted from this legal reservation are brief excerpts in connection with reviews or scholarly analysis or material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the work. Duplication of this publication or parts thereof is permitted only under the provisions of the Copyright Law of the Publisher's location, in its current version, and permission for use must always be obtained from Springer. Permissions for use may be obtained through RightsLink at the Copyright Clearance Center. Violations are liable to prosecution under the respective Copyright Law. ISBN-13 (pbk): 978-1-4842-0720-8 ISBN-13 (electronic): 978-1-4842-0719-2 Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director: Welmoed Spahr Lead Editor: Gwenan Spearing Technical Reviewer: Fabio Claudio Ferracchiati Editorial Board: Steve Anglin, Pramila Balen, Louise Corrigan, Jim DeWolf, Jonathan Gennick, Robert Hutchinson, Celestin Suresh John, Michelle Lowman, James Markham, Susan McDermott, Matthew Moodie, Jeffrey Pepper, Douglas Pundick, Ben Renow-Clarke, Gwenan Spearing Coordinating Editor: Melissa Maldonado Copy Editor: Kim Burton Compositor: SPi Global Indexer: SPi Global Artist: SPi Global Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail [email protected], or visit www.springer.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail [email protected], or visit www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this text is available to readers at www.apress.com. For detailed information about how to locate your book’s source code, go to www.apress.com/source-code/. I dedicate this book to my late father, Shree. H.B Rawal —Pathik Rawal Contents at a Glance About the Authors �������������������������������������������������������������������������������������������������xxiii About the Technical Reviewer �������������������������������������������������������������������������������xxv Acknowledgments �����������������������������������������������������������������������������������������������xxvii Introduction ����������������������������������������������������������������������������������������������������������xxix ■ Chapter 1: Getting Started with Windows 10 Applications �����������������������������������1 ■ Chapter 2: WinJS Fundamentals �������������������������������������������������������������������������15 ■ Chapter 3: Basic WinJS Controls �������������������������������������������������������������������������31 ■ Chapter 4: List Controls, AppBar, and ToolBar �����������������������������������������������������55 ■ Chapter 5: Data Binding and Navigation ��������������������������������������������������������������83 ■ Chapter 6: Adapting the UI for Different Screens ����������������������������������������������115 ■ Chapter 7: Application Lifecycle and Navigation �����������������������������������������������127 ■ Chapter 8: Globalization and Localization ���������������������������������������������������������145 ■ Chapter 9: Data Storage and App Data ��������������������������������������������������������������159 ■ Chapter 10: Sharing Data ����������������������������������������������������������������������������������181 ■ Chapter 11: Background Tasks ��������������������������������������������������������������������������213 ■ Chapter 12: Location and Maps in Windows Apps ��������������������������������������������221 ■ Chapter 13: Building Apps That Connect to the Cloud ���������������������������������������251 ■ Chapter 14: Tiles and Notifications �������������������������������������������������������������������275 ■ Chapter 15: Device Capabilities �������������������������������������������������������������������������287 v ■ Contents at a GlanCe ■ Chapter 16: Additional Tools ������������������������������������������������������������������������������307 ■ Chapter 17: Sideloading and Windows App Certification Kit �����������������������������327 ■ Chapter 18: Store and Monetization ������������������������������������������������������������������347 Index ���������������������������������������������������������������������������������������������������������������������365 vi Contents About the Authors �������������������������������������������������������������������������������������������������xxiii About the Technical Reviewer �������������������������������������������������������������������������������xxv Acknowledgments �����������������������������������������������������������������������������������������������xxvii Introduction ����������������������������������������������������������������������������������������������������������xxix ■ Chapter 1: Getting Started with Windows 10 Applications �����������������������������������1 1.1 Examining the Universal Windows Platform ...............................................................1 Problem ..................................................................................................................................................1 Solution...................................................................................................................................................1 1.2 Development Tools for Universal Windows Platform ..................................................3 Problem ..................................................................................................................................................3 Solution...................................................................................................................................................3 1.3 Creating Universal Windows Platform Application .....................................................4 Problem ..................................................................................................................................................4 Solution...................................................................................................................................................4 How It Works ...........................................................................................................................................5 1.4 Running Universal Windows Platform Apps ...............................................................7 Problem ..................................................................................................................................................7 Solution...................................................................................................................................................7 How It Works ...........................................................................................................................................8 vii ■ Contents ■ Chapter 2: WinJS Fundamentals �������������������������������������������������������������������������15 2.1 Namespaces in JavaScript .......................................................................................15 Problem ................................................................................................................................................15 Solution.................................................................................................................................................15 How It Works .........................................................................................................................................15 2.2 Add a Namespace to an Existing Namespace .........................................................18 Problem ................................................................................................................................................18 Solution.................................................................................................................................................18 How It works .........................................................................................................................................18 2.3 Creating a Class in WinJS .........................................................................................19 Problem ................................................................................................................................................19 Solution.................................................................................................................................................19 How It Works .........................................................................................................................................19 2.4 Deriving a Class in WinJS ........................................................................................22 Problem ................................................................................................................................................22 Solution.................................................................................................................................................22 How It Works .........................................................................................................................................22 2.5 Create Mixins in WinJS .............................................................................................24 Problem ................................................................................................................................................24 Solution.................................................................................................................................................24 How It Works .........................................................................................................................................24 2.6 Encapsulation in WinJS ............................................................................................26 Problem ................................................................................................................................................26 Solution.................................................................................................................................................26 How It Works .........................................................................................................................................26 2.7 Using Promise in WinJS ...........................................................................................29 Problem ................................................................................................................................................29 Solution.................................................................................................................................................29 How It Works .........................................................................................................................................29 viii ■ Contents ■ Chapter 3: Basic WinJS Controls �������������������������������������������������������������������������31 3.1 Declaring a WinJS Control on a Page .......................................................................31 Problem ................................................................................................................................................31 Solution.................................................................................................................................................31 How It Works .........................................................................................................................................31 3.2 Setting Options for WinJS Controls ..........................................................................34 Problem ................................................................................................................................................34 Solution.................................................................................................................................................34 How It Works .........................................................................................................................................34 3.3 Adding WinJS Controls from Your JavaScript Code ..................................................35 Problem ................................................................................................................................................35 Solution.................................................................................................................................................35 How It Works .........................................................................................................................................36 3.4 Getting the WinJS Controls from an HTML Document ..............................................38 Problem ................................................................................................................................................38 Solution.................................................................................................................................................38 How It Works .........................................................................................................................................39 3.5 The ToggleSwitch Control .........................................................................................40 Problem ................................................................................................................................................40 Solution.................................................................................................................................................40 How It Works .........................................................................................................................................41 3.6 The DatePicker Control .............................................................................................43 Problem ................................................................................................................................................43 Solution.................................................................................................................................................43 How It Works .........................................................................................................................................43 3.7 The TimePicker Control ............................................................................................46 Problem ................................................................................................................................................46 Solution.................................................................................................................................................46 How It Works .........................................................................................................................................46 ix ■ Contents 3.8 The Tooltip Control ....................................................................................................49 Problem ................................................................................................................................................49 Solution.................................................................................................................................................49 How It Works .........................................................................................................................................49 3.9 Displaying Text .........................................................................................................50 Problem ................................................................................................................................................50 Solution.................................................................................................................................................50 How It Works .........................................................................................................................................51 3.10 Editing Text in an App .............................................................................................52 Problem ................................................................................................................................................52 Solution.................................................................................................................................................52 How It Works .........................................................................................................................................52 ■ Chapter 4: List Controls, AppBar, and ToolBar �����������������������������������������������������55 4.1 Using the Repeater Control ......................................................................................55 Problem ................................................................................................................................................55 Solution.................................................................................................................................................55 How It Works .........................................................................................................................................55 4.2 Using the FlipView Control .......................................................................................59 Problem ................................................................................................................................................59 Solution.................................................................................................................................................59 How It Works .........................................................................................................................................59 4.3 Using the ListView Control .......................................................................................62 Problem ................................................................................................................................................62 Solution.................................................................................................................................................62 How It Works .........................................................................................................................................62 4.4 Filtering Items in the ListView Control .....................................................................66 Problem ................................................................................................................................................66 Solution.................................................................................................................................................66 How It Works .........................................................................................................................................66 x

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.