ebook img

Beginning Windows Phone 7 Development PDF

481 Pages·2010·19.12 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 Beginning Windows Phone 7 Development

SSSSSSSSttttttttaaaaaaaarrrrrrrrtttttttt ddddddddeeeeeeeevvvvvvvveeeeeeeellllllllooooooooppppppppiiiiiiiinnnnnnnngggggggg aaaaaaaapppppppppppppppplllllllliiiiiiiiccccccccaaaaaaaattttttttiiiiiiiioooooooonnnnnnnnssssssss ffffffffoooooooorrrrrrrr tttttttthhhhhhhheeeeeeee WWWWWWWWiiiiiiiinnnnnnnnddddddddoooooooowwwwwwwwssssssss PPPPPPPPhhhhhhhhoooooooonnnnnnnneeeeeeee qqqqqqqquuuuuuuuiiiiiiiicccccccckkkkkkkkllllllllyyyyyyyy aaaaaaaannnnnnnndddddddd eeeeeeeeaaaaaaaassssssssiiiiiiiillllllllyyyyyyyy BBBBBBBBeeeeeeeeggggggggiiiiiiiinnnnnnnnnnnnnnnniiiiiiiinnnnnnnngggggggg WWWWWWWWiiiiiiiinnnnnnnnddddddddoooooooowwwwwwwwssssssss PPPPPPPPhhhhhhhhoooooooonnnnnnnneeeeeeee 77777777 DDDDDDDDeeeeeeeevvvvvvvveeeeeeeellllllllooooooooppppppppmmmmmmmmeeeeeeeennnnnnnntttttttt HHHHHHHHeeeeeeeennnnnnnnrrrrrrrryyyyyyyy LLLLLLLLeeeeeeeeeeeeeeee |||||||| EEEEEEEEuuuuuuuuggggggggeeeeeeeennnnnnnneeeeeeee CCCCCCCChhhhhhhhuuuuuuuuvvvvvvvvyyyyyyyyrrrrrrrroooooooovvvvvvvv Beginning Windows Phone 7 Development ■ ■ ■ Henry Lee and Eugene Chuvyrov i Beginning Windows Phone 7 Development Copyright © 2010 by Henry Lee & Eugene Chuvyrov All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-13 (pbk): 978-1-4302-3216-2 ISBN-13 (electronic): 978-1-4302-3217-9 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 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. President and Publisher: Paul Manning Lead Editor: Ewan Buckingham Development Editor: John Osborn Technical Reviewer: Stefan Turalski Editorial Board: Steve Anglin, Mark Beckner, Ewan Buckingham, Gary Cornell, Jonathan Gennick, Jonathan Hassell, Michelle Lowman, Matthew Moodie, Duncan Parkes, Jeffrey Pepper, Frank Pohlmann, Douglas Pundick, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Jennifer L. Blackwell Copy Editor: Mary Ann Fugate Compositor: MacPS, LLC Indexer: Brenda Miller Artist: April Milne Cover Designer: Anna Ishchenko Distributed to the book trade worldwide by Springer Science+Business Media, LLC., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer- sbm.com, or visit www.springeronline.com. 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/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work. The source code for this book is available to readers at www.apress.com. ii To Erica, my beautiful wife, for her love and support. Thank you for always being there for me. —Henry Lee To Marianna—my friend, my wife, my muse—and to my parents for their gift of unconditional love. —Eugene Chuvyrov iii Contents at a Glance ■Contents................................................................................................................v(cid:1) ■About the Authors..............................................................................................xvi(cid:1) ■About the Technical Reviewer...........................................................................xvii(cid:1) ■Acknowledgments............................................................................................xviii(cid:1) ■Introduction .......................................................................................................xix Part 1: The Essentials of Windows Phone 7 Application Development....................1(cid:1) ■Chapter 1: Introducing Windows Phone 7 and the Windows Phone Platform.......3(cid:1) ■Chapter 2: Building Windows Phone 7 Applications...........................................15(cid:1) ■Chapter 3: Using Cloud Services As Data Stores.................................................35(cid:1) ■Chapter 4: Catching and Debugging Errors.........................................................97(cid:1) ■Chapter 5: Packaging, Publishing, and Managing Applications.......................121(cid:1) Part 2: Using Windows Phone 7 Technologies.....................................................139(cid:1) ■Chapter 6: Working with the Accelerometer.....................................................141(cid:1) ■Chapter 7: Application Bar................................................................................161(cid:1) ■Chapter 8: WebBrowser Control........................................................................179(cid:1) ■Chapter 9: Working with Controls and Themes..................................................193(cid:1) ■Chapter 10: Integrating Applications with the Windows Phone OS..................211(cid:1) ■Chapter 11: Creating Trial Applications............................................................229(cid:1) ■Chapter 12: Internationalization.......................................................................251(cid:1) ■Chapter 13: Isolated Storage.............................................................................267(cid:1) ■Chapter 14: Using Location Services.................................................................285(cid:1) ■Chapter 15: Media.............................................................................................311(cid:1) ■Chapter 16: Working with the Camera and Photos...........................................329(cid:1) ■Chapter 17: Push Notifications..........................................................................347(cid:1) ■Chapter 18: Reactive Extensions for .NET.........................................................383(cid:1) ■Chapter 19: Security.........................................................................................413(cid:1) ■Index.................................................................................................................441(cid:1) iv Contents ■Contents at a Glance............................................................................................iv(cid:1) ■About the Authors..............................................................................................xvi(cid:1) ■About the Technical Reviewer...........................................................................xvii(cid:1) ■Acknowledgments............................................................................................xviii(cid:1) ■Introduction........................................................................................................xix Part 1: The Essentials of Windows Phone 7 Application Development....................1(cid:1) ■Chapter 1: Introducing Windows Phone 7 and the Windows Phone Platform....................................................................3(cid:1) Windows Phone Overview...............................................................................................5(cid:1) Windows Phone Hardware Specifications......................................................................5(cid:1) Windows Phone Application Platform.............................................................................7(cid:1) Silverlight for Windows Phone...............................................................................................................7(cid:1) XNA for Windows Phone........................................................................................................................8(cid:1) Tools.......................................................................................................................................................8(cid:1) Cloud Services.....................................................................................................................................11(cid:1) Metro Design........................................................................................................................................12(cid:1) Application Development Life Cycle..............................................................................12(cid:1) Summary.......................................................................................................................14(cid:1) ■Chapter 2: Building Windows Phone 7 Applications...........................................15(cid:1) Preparing Your Development Machine..........................................................................15(cid:1) Building Your First Windows Phone 7 Application........................................................15(cid:1) Creating a Windows Phone Project......................................................................................................16(cid:1) v ■ CONTENTS Using Your First Windows Phone Silverlight Controls..........................................................................18(cid:1) Writing Your First Windows Phone Code..............................................................................................22(cid:1) Running Your First Silverlight Windows Phone Application.................................................................23(cid:1) Customizing Your First Windows Phone Application............................................................................25(cid:1) Styling Your Application.......................................................................................................................28(cid:1) Summary.......................................................................................................................34(cid:1) ■Chapter 3: Using Cloud Services As Data Stores.................................................35(cid:1) Introducing the MVVM Pattern......................................................................................36(cid:1) Introducing Microsoft Azure and SQL Azure.................................................................37(cid:1) Creating a Cloud Database............................................................................................37(cid:1) Creating an SQL Azure Database.........................................................................................................38(cid:1) Creating a Database in SQL Azure.......................................................................................................47(cid:1) Creating a Cloud Service to Access the Cloud Database..............................................50(cid:1) Creating a Windows Azure Project.......................................................................................................51(cid:1) Generating an Object Model to Access the Cloud Database................................................................52(cid:1) Implementing a WCF Service to Access the SQL Azure Database.......................................................57(cid:1) Building a Phone Client to Access a Cloud Service.......................................................64(cid:1) Creating a Windows Phone Project......................................................................................................64(cid:1) Building the User Interface..................................................................................................................65(cid:1) Coding MainPage.................................................................................................................................71(cid:1) Coding the BoolToVisibilityConvert......................................................................................................72(cid:1) Adding Reference to NotepadService..................................................................................................74(cid:1) Coding NotepadViewModel..................................................................................................................75(cid:1) Testing the Application Against NotepadService Deployed Locally.....................................................82(cid:1) Deploying the Service to Windows Azure............................................................................................83(cid:1) Testing the Notepad Application Against NotepadService Azure Service............................................94(cid:1) Summary.......................................................................................................................95(cid:1) ■Chapter 4: Catching and Debugging Errors.........................................................97(cid:1) Debugging Application Exceptions................................................................................97(cid:1) Debugging Page Load Exceptions........................................................................................................98(cid:1) vi ■ CONTENTS Debugging a Web Service Exception.................................................................................................102(cid:1) Testing the Application......................................................................................................................107(cid:1) Registering a Windows Phone Device for Debugging.................................................107(cid:1) Handling Device Exceptions........................................................................................113(cid:1) Creating the CatchDeviceExceptionDemo Project..............................................................................114(cid:1) Building the User Interface................................................................................................................115(cid:1) Coding the Application.......................................................................................................................117(cid:1) Testing the Finished Application........................................................................................................119(cid:1) Summary.....................................................................................................................119(cid:1) ■Chapter 5: Packaging, Publishing, and Managing Applications.......................121(cid:1) Windows Phone Application Publishing Lifecycle.......................................................121(cid:1) Windows Phone Application Certification Requirements............................................123(cid:1) Application Policies............................................................................................................................123(cid:1) Content Policies.................................................................................................................................125(cid:1) Application Submission Validation Requirements..............................................................................125(cid:1) Application Certification Requirements..............................................................................................126(cid:1) Submitting Your First Windows Phone Application to the Windows Phone Marketplace........................................................................128(cid:1) Package the application.....................................................................................................................128(cid:1) Submit the application.......................................................................................................................129(cid:1) Updating your application..................................................................................................................136(cid:1) Finding your application in the Marketplace......................................................................................137(cid:1) Summary.....................................................................................................................138(cid:1) Part 2: Using Windows Phone 7 Technologies.....................................................139(cid:1) ■Chapter 6: Working with the Accelerometer.....................................................141(cid:1) Understanding Orientation and Movement.................................................................141(cid:1) Calculating Distance..........................................................................................................................144(cid:1) Calculating Pitch and Roll..................................................................................................................144(cid:1) Introducing SDK Support for Accelerometers.............................................................146(cid:1) vii ■ CONTENTS Retrieving Accelerometer Data...................................................................................146(cid:1) Creating the CaptureAccelerometerData Project...............................................................................147(cid:1) Building the User Interface................................................................................................................148(cid:1) Coding the Application.......................................................................................................................150(cid:1) Testing the Finished Application........................................................................................................152(cid:1) Using Accelerometer Data to Move a Ball...................................................................153(cid:1) Creating the MoveBall Project............................................................................................................154(cid:1) Building the User Interface................................................................................................................155(cid:1) Coding the Application.......................................................................................................................157(cid:1) Testing the Finished Application........................................................................................................159(cid:1) Summary.....................................................................................................................159(cid:1) ■Chapter 7: Application Bar................................................................................161(cid:1) Introducing the Application Bar..................................................................................162(cid:1) Adding an Application Bar to a Windows Phone 7 Application...................................163(cid:1) Adding Images for Use with Application Bar Buttons........................................................................164(cid:1) Adding a Global Application Bar Using XAML.....................................................................................166(cid:1) Adding a Local Application Bar Using XAML......................................................................................167(cid:1) Adding Menu Items............................................................................................................................168(cid:1) Adding an Application Bar Using Managed Code...............................................................................169(cid:1) Wiring Up Events to an Application Bar......................................................................171(cid:1) Adding “Glue” Code and a “Worker Function” to the Add Button......................................................171(cid:1) Reacting to Add Button Events...........................................................................................................172(cid:1) Reacting to Save Button Events.........................................................................................................175(cid:1) Reacting to Menu Events...................................................................................................................175(cid:1) Adding Event Handlers with XAML.....................................................................................................176(cid:1) Summary.....................................................................................................................177(cid:1) ■Chapter 8: WebBrowser Control........................................................................179(cid:1) Introducing the WebBrowser Control..........................................................................179(cid:1) Adding a WebBrowser Control....................................................................................180(cid:1) viii

Description:
Microsoft is injecting new energy into the smart phone marketplace with the sophisticated Windows Phone 7. This new energy equates to new opportunities for you, the mobile developer. Beginning Windows Phone 7 Development has been written specifically to help you seize these opportunities and begin c
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.