Microsoft_Press_eBook_Programming_Windows_8_Apps_with_HTML_CSS_and_JavaScript_PDF.pdf
(
18385 KB
)
Pobierz
1
99
PUBLISHED BY
Microsoft Press
A Division of Microsoft Corporation
One Microsoft Way
Redmond, Washington 98052-6399
Copyright © 2012 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.
ISBN: 978-0-7356-7261-1
Microsoft Press books are available through booksellers and distributors worldwide. If you need support
related to this book, email Microsoft Press Book Support at
mspinput@microsoft.com
. 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
2
Table of Contents
Introduction
............................................................................................................................................ 19
Who This Book Is For ................................................................................................................................................................... 20
What You'll Need (Can You Say “Samples”?) ...................................................................................................................... 21
A Formatting Note........................................................................................................................................................................ 22
Acknowledgements ...................................................................................................................................................................... 23
Errata & Book Support ................................................................................................................................................................ 24
We Want to Hear from You....................................................................................................................................................... 25
Stay in Touch .................................................................................................................................................................................. 25
Chapter 1: The Life Story of a Windows Store App:
Platform Characteristics of Windows 8................................................................................... 26
Leaving Home: Onboarding to the Windows Store.......................................................................................................... 27
Discovery, Acquisition, and Installation................................................................................................................................. 30
Playing in Your Own Room: The App Container................................................................................................................ 34
Different Views of Life: View States and Resolution Scaling .......................................................................................... 37
Those Capabilities Again: Getting to Data and Devices .................................................................................................. 40
Taking a Break, Getting Some Rest: Process Lifecycle Management .......................................................................... 43
Remembering Yourself: App State and Roaming .............................................................................................................. 45
Coming Back Home: Updates and New Opportunities ................................................................................................... 48
And, Oh Yes, Then There’s Design .......................................................................................................................................... 50
Chapter 2: Quickstart ................................................................................................................ 52
A Really Quick Quickstart: The Blank App Template ........................................................................................................ 52
Blank App Project Structure.................................................................................................................................................. 55
QuickStart #1: Here My Am! and an Introduction to Blend for Visual Studio......................................................... 59
Design Wireframes ................................................................................................................................................................... 59
Create the Markup ................................................................................................................................................................... 62
Styling in Blend.......................................................................................................................................................................... 64
Adding the Code ...................................................................................................................................................................... 68
Creating a Map with the Current Location ..................................................................................................................... 69
Oh Wait, the Manifest! ........................................................................................................................................................... 73
3
Capturing a Photo from the Camera ................................................................................................................................ 75
Sharing the Fun! ....................................................................................................................................................................... 78
Extra Credit: Receiving Messages from the iframe ....................................................................................................... 81
The Other Templates ................................................................................................................................................................... 82
Fixed Layout Template............................................................................................................................................................ 82
Navigation Template............................................................................................................................................................... 83
Grid Template ............................................................................................................................................................................ 83
Split Template ............................................................................................................................................................................ 83
What We’ve Just Learned ........................................................................................................................................................... 84
Chapter 3: App Anatomy and Page Navigation..................................................................... 85
Local and Web Contexts within the App Host.................................................................................................................... 86
Referencing Content from App Data: ms-appdata....................................................................................................... 90
Here My Am! with ms-appdata........................................................................................................................................... 92
Sequential Async Operations: Chaining Promises ............................................................................................................. 94
Error Handling Within Promises: then vs. done............................................................................................................. 96
Debug Output, Error Reports, and the Event Viewer................................................................................................... 96
App Activation................................................................................................................................................................................ 99
Branding Your App 101: The Splash Screen and Other Visuals................................................................................ 99
Activation Event Sequence..................................................................................................................................................101
Activation Code Paths...........................................................................................................................................................103
WinJS.Application Events .....................................................................................................................................................105
Extended Splash Screens......................................................................................................................................................106
Activation Deferrals ...............................................................................................................................................................108
App Lifecycle Transition Events and Session State ..........................................................................................................109
Suspend, Resume, and Terminate.....................................................................................................................................109
Basic Session State in Here My Am! .................................................................................................................................114
Data from Services and WinJS.xhr .........................................................................................................................................116
Handling Network Connectivity (in Brief) ......................................................................................................................119
Tips and Tricks for WinJS.xhr ..............................................................................................................................................120
Page Controls and Navigation ...............................................................................................................................................121
4
WinJS Tools for Pages and Page Navigation ................................................................................................................121
The Navigation App Template, PageControl Structure, and PageControlNavigator .....................................123
The Navigation Process and Navigation Styles ............................................................................................................129
Optimizing Page Switching: Show-and-Hide ...............................................................................................................130
WinRT Events and removeEventListener.............................................................................................................................131
Completing the Promises Story..............................................................................................................................................133
What We’ve Just Learned .........................................................................................................................................................135
Chapter 4: Controls, Control Styling, and Data Binding ..................................................... 136
The Control Model for HTML, CSS, and JavaScript .........................................................................................................137
HTML Controls .............................................................................................................................................................................138
WinJS stylesheets: ui-light.css, ui-dark.css, and win-* styles ....................................................................................141
Extensions to HTML Elements ............................................................................................................................................142
WinJS Controls .............................................................................................................................................................................142
WinJS Control Instantiation.................................................................................................................................................144
Strict Processing and processAll Functions....................................................................................................................145
Example: WinJS.UI.Rating Control.....................................................................................................................................146
Example: WinJS.UI.Tooltip Control ...................................................................................................................................147
Working with Controls in Blend.............................................................................................................................................149
Control Styling .............................................................................................................................................................................151
Styling Gallery: HTML Controls ..........................................................................................................................................153
Styling Gallery: WinJS Controls ..........................................................................................................................................155
Some Tips and Tricks .............................................................................................................................................................158
Custom Controls..........................................................................................................................................................................159
Custom Control Examples ...................................................................................................................................................161
Custom Controls in Blend....................................................................................................................................................164
Data Binding .................................................................................................................................................................................167
Data Binding in WinJS...........................................................................................................................................................169
One-Time Binding..................................................................................................................................................................170
One-Way Binding...................................................................................................................................................................173
Implementing Two-Way Binding .....................................................................................................................................175
5
Plik z chomika:
ferdekiepski
Inne pliki z tego folderu:
656949ebook.pdf
(21575 KB)
Configure Kerberos Authentication for SharePoint 2010 Products.pdf
(22619 KB)
693616ebook.pdf
(2572 KB)
AGM_BitLocker_Administration_and_Monitoring_1.0.pdf
(1593 KB)
AGM_Application_Virtualization_(App-V)_5.0.pdf
(1605 KB)
Inne foldery tego chomika:
Zgłoś jeśli
naruszono regulamin