- ホーム
- > 洋書
- > 英文書
- > Computer / General
Full Description
Already comfortable with JavaScript and HTML? Microsoft has just empowered you to build breakthrough apps for Windows 8. 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, test, and distribute outstanding Windows 8 software with JavaScript and HTML5.Walther clearly demonstrates the unique advantages Windows 8 offers to web developers. He guides you through using Microsoft's new WinJS library to develop apps for Microsoft's brand-new version of Windows--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.If you're a web developer, Windows 8 gives you millions of new potential users--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 StoreCreate apps that work great with touch, keyboard, stylus, and mouseUse JavaScript controls such as the Tooltip, Rating, DatePicker, and FlipView controlsThoroughly master using the WinJS ListView control to display, sort, and filter dataUse HTML5 Canvas to build arcade gamesStore data on the local file system, via remote web services, or in IndexedDB databasesUse Live Services to authenticate users, retrieve user profiles, and interact with SkyDriveCreate custom WinJS controls with Page ControlsBuild apps that gracefully adapt to different screen resolutions and orientationsTake pictures from your computer's webcam and play sounds
Contents
Introduction 11 Building Windows Store Apps 5What Is a Windows Store App? 5Microsoft Design Style Principles 6Common Features of Windows Store Apps 8Creating Your First Windows Store App 13Creating the Visual Studio Project 13Declaring App Capabilities 15Creating the HTML Page 16Creating the Style Sheet 17Creating the JavaScript File Running the App 20Elements of a Windows Store App 21JavaScript 21HTML5 21Cascading Style Sheets 3 22Windows Runtime 22Windows Library for JavaScript 23What about jQuery? 23Building Windows Store Apps with Visual Studio 26Windows Store App Project Templates 26Running a Windows Store App 34Debugging a Windows Store App 35Using the Visual Studio JavaScript Console Window 35Setting Breakpoints 37Using the DOM Explorer 37Publishing to the Windows Store 38Register as a Windows Developer 38Submitting Your App 39Passing App Certification 41Summary 422 WinJS Fundamentals 45Namespaces, Modules, and Classes 45Using Namespaces 46Using the Module Pattern 48Using Classes 51Asynchronous Programming with Promises 56Using Promises 57Using then() versus done() 58Creating Promises Creating a Timeout Promise 61Canceling Promises 62Composing Promises 63Retrieving DOM Elements with Query Selectors 63Performing Queries with the WinJS.Utilities.query() Method 64Retrieving a Single Element with the WinJS.Utilities.id() Method 66Using the WinJS.Utilities.children() Method 67Working with the QueryCollection Class 68Performing Ajax Calls with the xhr Function 69Specifying Different Response Types 72Customizing the Properties of the XmlHttpRequest Object 73Summary 753 Observables, Bindings, and Templates 77Understanding Observables 77Creating an Observable 78Creating Observable Listeners 79Coalescing Notifications 81Bypassing Notifications 82Working with the WinJS.Binding.List Object 83Creating an Observable Collection of Observables 86Understanding Declarative Data Binding 86Declarative Data Binding and Observables 89Capturing the Contents of an HTML Form 91Declarative Data Binding and WinJS Controls 94Declarative Data Binding and Binding Converters 96Understanding Templates 100Creating an Imperative Template 100Creating a Declarative Template 103Applying a Template with a Query Selector 104Creating External Templates 106Summary 1084 Using WinJS Controls 109Introduction to WinJS Controls 109Creating a WinJS Control Declaratively 111Creating Controls Imperatively 113Setting Control Options 114Retrieving Controls from an HTML Document 115Using the Tooltip Control 116Using the contentElement Property 117Styling a Tooltip 117Using the ToggleSwitch Control 118Determining the State of a ToggleSwitch 118Using the Rating Control 120Customizing the Ratings 121Submitting a Rating 121Using the DatePicker Control 123Formatting the Year, Month, and Date 124Displaying Only Years, Months, or Days 126Capturing the Selected Date 127Using the TimePicker Control 128Getting and Setting the Current Time 130Formatting the Hour, Minute, and Period 131Using the FlipView Control 132Displaying Page Numbers 135Creating Custom FlipView Buttons 137Summary 1395 Creating Forms 141Using HTML5 Form Validation 141Using the required Attribute 142Using the pattern Attribute 142Performing Custom Validation 143Customizing the Validation Error Style 144Resetting a Form 146Using HTML5 Input Elements Labeling Form Fields 148Entering a Number 149Entering a Value from a Range of Values 151Entering Email Addresses, URLs, Telephone Numbers, and Search Terms 151Entering a Value from a List of Values 153Selecting Files 154Creating a Rich Text Editor 155Displaying Progress 156Summary 1586 Menus and Flyouts 161Using the Flyout Control 161Using the Menu Control 163Using the AppBar Control 167Creating a Simple App Bar 168Using App Bar Commands 170Showing Contextual Commands 173Configuring App Settings 175Creating About Page Settings. 176Creating Personal Settings 178Displaying Windows Dialogs 182Summary 1847 Using the ListView Control 185Introduction to the ListView Control 185Using List Layout versus Grid Layout 190Preventing Overlapping ListView Items 193Selecting Items in a ListView Control 197Creating a Master/Detail View 198Selecting Multiple Items 202Sorting Items in a ListView Control 204Filtering Items in a ListView Control 206Grouping Items in a ListView Control 208Switching Views with Semantic Zoom 211Switching a ListView Template Dynamically 216Loading ListView Items Incrementally 219Summary 2218 Creating Data Sources 223Creating Custom Data Sources 223Creating the Data Source Class 224Creating a Data Adapter 224Implementing the getCount() Method 225Implementing the itemsFromIndex() Method 225Implementing the insertAtEnd() Method 227Implementing the remove() Method 227Implementing the change() Method 228Handling Errors 228Implementing the setNotificationHandler() Method 229Creating a File Data Source 230Using the File Data Source 231Creating a Web Service Data Source 236Creating the Data Source 236Creating the Web Service 237Using the Web Service Data Source 240Creating an IndexedDB Data Source 241Overview of IndexedDB 241Using the IndexedDB Data Source 245Summary 2529 App Events and States 253App Events 253Handling the Activated Event 254Handling the Error Event 255Deferring Events with Promises 256Creating Custom Events 257Suspending, Terminating, and Resuming an App 257Detecting When an App Is Suspended and Terminated 258Detecting the Previous Execution State 258Testing Application State with Visual Studio 259Storing State with Session State 260Application View States 61Snapped, Filled, Portrait, and Landscape 261Using Media Queries 264Using the JavaScript mediaMatch Method 266Defining a Viewport 267Summary 27010 Page Fragments and Navigation 273Using the HtmlControl Control 273Creating a Page Control 276Creating Multipage Apps 280Creating a Navigation App 280Understanding the Navigation App default.html Page 281Adding New Page Controls to a Navigation App 283Navigating to Another Page 285Understanding the Navigation API 286Understanding the PageControlNavigator Control 287Understanding Navigation State 287Summary 29111 Using the Live Connect API 293Installing the Live SDK 294Adding a Reference to the Live SDK 294Registering Your App 294Initializing the Live Connect SDK 296Specifying Different Scopes 296Authenticating a User 299Using WL.login() 299Using the SignIn Control 300Authentication Events 302Passing an Authentication Token to a Web Service 303Sending the Authentication Token from a Windows Store App 303Verifying the Authentication Token in a Web Service 306Retrieving the User ID 308Retrieving Basic User Information 309Uploading and Downloading Files from SkyDrive 311Listing SkyDrive Folders and Files 312Downloading Files from SkyDrive 314Uploading Files to SkyDrive 316Summary 31812 Graphics and Games 319Overview of the Game 320Creating the Game Tiles 321Playing the Game Sounds 322Creating the Game Canvas 323Capturing User Interaction 325Creating the Update Loop 327Creating the Render Loop 329Summary 331Index 333



