1. Trang chủ
  2. » Công Nghệ Thông Tin

Getting started with metro style apps

110 86 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 110
Dung lượng 11,65 MB

Nội dung

www.it-ebooks.info www.it-ebooks.info Getting Started with Metro Style Apps Ben Dewey Beijing • Cambridge • Farnham • Kưln • Sebastopol • Tokyo www.it-ebooks.info Getting Started with Metro Style Apps by Ben Dewey Copyright © 2012 Ben Dewey All rights reserved Printed in the United States of America Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472 O’Reilly books may be purchased for educational, business, or sales promotional use Online editions are also available for most titles (http://my.safaribooksonline.com) For more information, contact our corporate/institutional sales department: 800-998-9938 or corporate@oreilly.com Editor: Rachel Roumeliotis Production Editor: Melanie Yarbrough Proofreader: Melanie Yarbrough Cover Designer: Karen Montgomery Interior Designer: David Futato Illustrator: Robert Romano Revision History for the First Edition: 2012-07-23 First release See http://oreilly.com/catalog/errata.csp?isbn=9781449320553 for release details Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc Getting Started with Metro Style Apps, the cover image of an American Crocodile, and related trade dress are trademarks of O’Reilly Media, Inc Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks Where those designations appear in this book, and O’Reilly Media, Inc., was aware of a trademark claim, the designations have been printed in caps or initial caps While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein ISBN: 978-1-449-32055-3 [LSI] 1342718033 www.it-ebooks.info Table of Contents Preface vii Windows 8: A Quick Tour A User Interface for Touch Start Screen Start Bar Windows Programming Reimagined A New Native APIJ: The Windows Runtime Language Support Hosted Application Model Single File Deployment Windows Store Inside Metro Style Apps Application Bar Semantic Zoom Animation Outside Your App Tiles Pickers Charms Sensors and Devices Summary 8 8 10 11 11 12 12 12 13 Getting Started 15 Where Is the Hello World app? Bing Search API Getting Started: The BingSimpleSearch App Bing Search API Service class Calling the Bing Search API Wrapping Up the UI Running the BingSimpleSearch App 15 15 18 21 22 22 23 iii www.it-ebooks.info Unlocking WinRT (the FileSavePicker) Summary 23 26 Application Architecture 27 The Bing Image Search App Goals Usability Non-functional Development Process Goals Design of the User Interface Application Diagram Model-View-ViewModel (MVVM) Who Comes First: the View or the ViewModel (the ViewModelLocator)? Commands Inversion of Control (IoC) Container Navigation NavigationService MessageHub Sending a Message Alternatives to the MessageHub Application Storage and Tombstoning Settings Summary 27 27 28 29 30 30 32 32 33 35 35 37 39 40 41 42 42 44 45 Interacting with the Operating System 47 Search Declaring Your Search Intentions Handling SearchPane.QuerySubmitted Launching Your App Directly into Search Mode Tiles Updating the Tile with a Collection of Images Updating Multiple Tiles with a Single Command Pickers FileOpenPicker FileSavePicker Sharing ShareDataRequestedMessagePump ShareUriHandler ShareImageResultsHandler Sensors LockScreen Summary iv | Table of Contents www.it-ebooks.info 48 48 48 53 54 55 57 59 60 65 68 69 71 71 74 75 76 Windows Store 77 Marketing Windows Store App Opening Your Developer Account Selling Your App Ratings and Reviews Distribution Packaging Your App Inside your Appx Running Windows App Cert Kit Publishing Your App Global Reach Exposure to Global Markets Localization Summary 77 78 79 81 82 82 83 86 87 88 89 90 91 92 Table of Contents | v www.it-ebooks.info www.it-ebooks.info Preface The personal computer (PC), which first hit the market over 30 years ago, has undergone tectonic changes that, in turn, launched the PC era PCs were primarily used in the workplace where software was simple and optimized for use with the keyboard; touching a screen was unheard of until recently Slowly computers began creeping into the home and many users didn’t know what to with them; they were glorified typewriters When PCs started connecting to the Internet, possibilities reached a new level, which had a snowball effect It allowed academia to share research; it spawned new means of communication from email and online chat to social networking, captivating the minds of people young and old Soon consumers started using laptops and unplugging from the conventional desktop setting This shift had little impact on applications, but helped define a new wave of form factors in phones, tablets, and slates Eventually, users started demanding more and we ushered in a new era, the modern consumer era We are all modern consumers, not only consumers of goods, but consumers of information We are constantly connected through the use of mobile devices as well as more traditional computers Whatever type of device, be it static or mobile, content is synchronized and up-to-date These new devices are used as gaming machines and personal entertainment centers, and they are replacing books and magazines for many avid readers Today, consumers expect developers to create apps where touch, mobility, and good battery life are a must Tablets and slates leverage touch as a primary form of interaction while playing a critical role in the adoption of sensors and cameras in everyday computing They are small and lightweight, making them extremely portable Devices boot almost instantly so users can get to their content and put them right back in their bag without missing a step Despite their youth, these devices are being embraced by work forces and consumers worldwide and they appear to be on a relentless progression With all this excitement, it’s hard to believe we’ve only begun to scratch the surface We need a platform built from the ground up with these objectives in mind This next version of Windows, code-named Windows 8, ships with a new application model for building user experiences tailored to the next generation of devices vii www.it-ebooks.info The Windows Runtime The underpinning for that new user experience is the Windows Runtime For years Windows desktop applications interacted with the Win32APIs in some fashion, whether they were opening file dialogs, rendering graphics, or communicating over the network Instead of replacing this, Windows continues its support for the Win32APIs allowing existing Windows apps to run seamlessly What they built instead is a brand new API from the ground up called the Windows Runtime (WinRT) WinRT consists of an application execution environment and a collection of new APIs, which enables a new line of immersive full screen apps called Metro style apps Windows desktop applications are still available and continue to be relevant for many situations In fact, desktop applications can leverage the power of the Windows Runtime API—for example communicating with sensors Metro style apps are designed to communicate with WinRT via a language-independent projection layer, which enables apps to be written in statically-typed languages like C ++, C#, and Visual Basic, while also feeling natural to dynamic languages like JavaScript WinRT introduces a new trust model for users, called base trust Unlike full trust, this model isolates each application while funneling high-level action through the runtime broker to ensure users are aware when apps attempt to access protected resources Even though Metro style apps promote a model where the user is in charge, you will find their ability to connect with other apps is far superior than its predecessor Metro style apps can communicate with other apps using generic contracts and send or receive content in various formats—like text and photos Contracts can also be defined to access core operating system components, like Search, to highlight your app even though it may seem irrelevant (We’ll discuss contracts and search later in Chapter 4.) Once a revolutionary technology, like mobile computing, has been unleashed it’s hard not to push its potential You can already see signs that manufacturers and researchers are innovating well beyond what is on the streets today Microsoft is committed to contributing to the future of technology in a big way and Windows is just the start For more insight and the impending possibilities into what’s next for Microsoft, a video of their vision for the future can be found online at http://www youtube.com/playlist?list=PL2B8C6AB94E8259C6 Disclaimer Windows is currently in Release Preview; as such, some of the content in this book may change viii | Preface www.it-ebooks.info ...www.it-ebooks.info Getting Started with Metro Style Apps Ben Dewey Beijing • Cambridge • Farnham • Köln • Sebastopol • Tokyo www.it-ebooks.info Getting Started with Metro Style Apps by Ben Dewey... http://bendewey.com /getting- started -with- metro- apps and at https://github.com/bendewey/GettingStartedWithMetroApps How This Book Is Organized This book focuses on helping you become familiar with the new... the user Metro style apps are no exception Using resources in Metro style apps is slightly different, but still simple To access the resource you will need a new Resource Loader object With this

Ngày đăng: 12/03/2019, 10:26