PUBLISHED BY Microsoft Press A Division of Microsoft Corporation One Microsoft Way Redmond, Washington 98052-6399 Copyright © 2014 Microsoft Corporation All rights reserved. No part of the contents of this book may be reproduced or transmitted in any form or by any means without the written permission of the publisher. Microsoft Press books are available through booksellers and distributors worldwide. If you need support related to this book, email Microsoft Press Book Support at [email protected]. Please tell us what you think of this book at http://aka.ms/tellpress. Unless otherwise noted, the companies, organizations, products, domain names, e-mail addresses, logos, people, places, and events depicted in examples herein are fictitious. No association with any real company, organization, product, domain name, e-mail address, logo, person, place, or event is intended or should be inferred. Complying with all applicable copyright laws is the responsibility of the user. Without limiting the rights under copyright, no part of this document may be reproduced, stored in or introduced into a retrieval system, or transmitted in any form or by any means (electronic, mechanical, photocopying, recording, or otherwise), or for any purpose, without the express written permission of Microsoft Corporation. Microsoft and the trademarks listed at http://www.microsoft.com/about/legal/en/us/IntellectualProperty/ Trademarks/EN-US.aspx are trademarks of the Microsoft group of companies. All other marks are property of their respective owners. This book expresses the author’s views and opinions. The information contained in this book is provided without any express, statutory, or implied warranties. Neither the authors, Microsoft Corporation, nor its resellers, or distributors will be held liable for any damages caused or alleged to be caused either directly or indirectly by this book. Acquisitions, Developmental, and Project Editor: Devon Musgrave Cover: Twist Creative • Seattle and Joel Panchot 1 Table of Contents Introduction ........................................................................................................................ 21 Who This Book Is For ........................................................................................................ 23 What You'll Need (Can You Say “Samples”?) ...................................................................... 24 A Formatting Note............................................................................................................ 25 Acknowledgements .......................................................................................................... 26 Free Ebooks from Microsoft Press ..................................................................................... 28 The “Microsoft Press Guided Tours” App ........................................................................... 28 Errata & Book Support ...................................................................................................... 28 We Want to Hear from You............................................................................................... 29 Stay in Touch ................................................................................................................... 29 Chapter 1 The Life Story of a Windows Store App: Characteristics of the Windows Platform .............................................................................................................. 30 Leaving Home: Onboarding to the Windows Store ............................................................. 32 Discovery, Acquisition, and Installation.............................................................................. 35 Playing in Your Own Room: The App Container .................................................................. 39 Different Views of Life: Views and Resolution Scaling ......................................................... 42 Those Capabilities Again: Getting to Data and Devices ........................................................ 46 Taking a Break, Getting Some Rest: Process Lifecycle Management..................................... 49 Remembering Yourself: App State and Roaming................................................................. 51 Coming Back Home: Updates and New Opportunities ........................................................ 56 And, Oh Yes, Then There’s Design ..................................................................................... 58 Feature Roadmap and Cross-Reference ............................................................................. 59 Chapter 2 Quickstart .......................................................................................................... 65 A Really Quick Quickstart: The Blank App Template ............................................................ 65 Blank App Project Structure .......................................................................................... 68 2 QuickStart #1: Here My Am! and an Introduction to Blend for Visual Studio ........................ 72 Design Wireframes ....................................................................................................... 73 Create the Markup ....................................................................................................... 76 Styling in Blend............................................................................................................. 78 Adding the Code........................................................................................................... 83 Extra Credit: Improving the App ........................................................................................ 97 Receiving Messages from the iframe ............................................................................. 98 Improving the Placeholder Image with a Canvas Element................................................ 99 Handling Variable Image Sizes ..................................................................................... 100 Moving the Captured Image to AppData (or the Pictures Library) .................................. 103 Using a Thumbnail Instead of the Full Image ................................................................ 105 The Other Templates: Projects and Items ........................................................................ 107 Navigation App Template............................................................................................ 107 Grid App Template ..................................................................................................... 107 Hub App Template...................................................................................................... 108 Split Template ............................................................................................................ 108 Item Templates .......................................................................................................... 108 What We’ve Just Learned ............................................................................................... 109 Chapter 3 App Anatomy and Performance Fundamentals .................................................. 111 App Activation ............................................................................................................... 112 Branding Your App 101: The Splash Screen and Other Visuals ....................................... 113 Activation Event Sequence .......................................................................................... 117 Activation Code Paths ................................................................................................. 119 WinJS.Application Events ............................................................................................ 121 Optimizing Startup Time ............................................................................................. 124 WinRT Events and removeEventListener.......................................................................... 126 App Lifecycle Transition Events and Session State ............................................................ 128 Suspend, Resume, and Terminate................................................................................ 129 3 Basic Session State in Here My Am! ............................................................................. 133 Page Controls and Navigation ......................................................................................... 136 WinJS Tools for Pages and Page Navigation .................................................................. 136 The Navigation App Template, PageControl Structure, and PageControlNavigator ......... 139 The Navigation Process and Navigation Styles .............................................................. 146 Optimizing Page Switching: Show-and-Hide ................................................................. 148 Page-Specific Styling ................................................................................................... 149 Async Operations: Be True to Your Promises .................................................................... 151 Using Promises ........................................................................................................... 151 Joining Parallel Promises ............................................................................................. 153 Sequential Promises: Nesting and Chaining .................................................................
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages96 Page
-
File Size-