832 beginning windows phone 7 application development

602 131 0
832 beginning windows phone 7 application development

Đ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

www.it-ebooks.info www.it-ebooks.info ffirs.indd ii 3/28/11 1:11:06 PM BEGINNING WINDOWS® PHONE APPLICATION DEVELOPMENT INTRODUCTION xvii CHAPTER Introducing Windows Phone CHAPTER Jaw-Dropping Apps with the Help of Silverlight 23 CHAPTER Spice Up Your App with Shapes, Colors, Brushes, and Transforms 65 CHAPTER Advanced User Interface Techniques: Styles, Templates, and the Visual State Manager 99 CHAPTER Isolated Storage, Page Navigation, and the Application Life Cycle 147 CHAPTER Interacting with the Hardware 183 CHAPTER Launchers, Choosers, and Advanced User Input 225 CHAPTER Windows Phone Services and Cloud Services 277 CHAPTER Creating and Consuming Web Services 305 CHAPTER 10 Web Services Push Notifications 347 CHAPTER 11 XNA for Windows Phone 375 CHAPTER 12 Microsoft Expression Blend 435 CHAPTER 13 Using the Silverlight for Windows Phone Toolkit and Creating Panoramic User Interfaces 467 CHAPTER 14 Patterns, Frameworks, and Tests 491 CHAPTER 15 Publishing Your Application 525 APPENDIX Solutions to Exercises 547 INDEX 565 www.it-ebooks.info ffirs.indd i 3/28/11 1:11:03 PM www.it-ebooks.info ffirs.indd ii 3/28/11 1:11:06 PM BEGINNING Windows® Phone Application Development BUILDING WINDOWS® PHONE APPLICATIONS USING SILVERLIGHT® AND XNA® Nick Lecrenski Karli Watson Robert Fonseca-Ensor www.it-ebooks.info ffirs.indd iii 3/28/11 1:11:06 PM Beginning Windows® Phone Application Development: Building Windows® Phone Applications Using Silverlight® and XNA® Published by Wiley Publishing, Inc 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2011 Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-0-470-91233-1 ISBN: 978-1-118-09628-4 (ebk) ISBN: 978-1-118-09629-1 (ebk) ISBN: 978-1-118-09630-7 (ebk) Manufactured in the United States of America 10 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600 Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose No warranty may be created or extended by sales or promotional materials The advice and strategies contained herein may not be suitable for every situation This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services If professional assistance is required, the services of a competent professional person should be sought Neither the publisher nor the author shall be liable for damages arising herefrom The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or website may provide or recommendations it may make Further, readers should be aware that Internet websites listed in this work may have changed or disappeared between when this work was written and when it is read For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002 Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in electronic books Library of Congress Control Number: 2011920899 Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, and Wrox Programmer to Programmer are trademarks or registered trademarks of John Wiley & Sons, Inc and/or its affi liates, in the United States and other countries, and may not be used without written permission Windows, Silverlight, and XNA are registered trademarks of Microsoft Corporation All other trademarks are the property of their respective owners Wiley Publishing, Inc is not associated with any product or vendor mentioned in this book www.it-ebooks.info ffirs.indd iv 3/28/11 1:11:08 PM This book is dedicated to my beautiful wife, Kristie, and my daughters, Tabetha and Cheyenne —Nick Lecrenski For donna —Karli Watson For the love of my life, Cara —Robert Fonseca-Ensor www.it-ebooks.info ffirs.indd v 3/28/11 1:11:09 PM CREDITS ACQUISITIONS EDITOR PRODUCTION MANAGER Paul Reese Tim Tate PROJECT EDITOR VICE PRESIDENT AND EXECUTIVE GROUP PUBLISHER Ginny Bess Munroe Richard Swadley TECHNICAL EDITOR VICE PRESIDENT AND EXECUTIVE PUBLISHER Jonathan Marbutt Barry Pruett PRODUCTION EDITOR ASSOCIATE PUBLISHER Kathleen Wisor Jim Minatel COPY EDITOR PROJECT COORDINATOR, COVER Kitty Wilson Katie Crocker EDITORIAL DIRECTOR PROOFREADER Robyn B Siesky Nancy Carrasco EDITORIAL MANAGER INDEXER Mary Beth Wakefield Robert Swanson FREELANCER EDITORIAL MANAGER COVER DESIGNER Rosemarie Graham Michael Trent ASSOCIATE DIRECTOR OF MARKETING COVER IMAGE David Mayhew © iStock/Oleksiy Mark www.it-ebooks.info ffirs.indd vi 3/28/11 1:11:10 PM ABOUT THE AUTHORS NICK LECRENSKI is a developer with 10 years of experience in a wide range of Microsoft technologies including Visual C++, C#, VB, VB.NET, SQL Server, NET Framework, ASP.NET, AJAX, Silverlight, and more He has a BS in Computer Science and has worked in various fields from biometrics to financial services He is also the founder and lead developer of MyFitnessJournal.com, a fitness training website that currently utilizes Silverlight technology He is also the author of Silverlight 4: Problem - Design - Solution, available from www.wrox.com KARLI WATSON is an IT contractor and author currently working in London in the fi nancial sector For the most part, he immerses himself in NET (in particular, C#) and has written numerous books in the field for several publishers He specializes in communicating complex ideas in a way that is accessible to anyone with a passion to learn, and he spends much of his time playing with technology to fi nd new things to teach people During those (seemingly few) times where he isn’t doing the previous, Karli is probably wishing he was hurtling down a mountain on a snowboard or possibly trying to get his novel published Either way, you’ll know him by his brightly colored clothes ROBERT FONSECA-ENSOR is a software engineer consulting with Infusion (www.infusion.com) From New Zealand, he currently lives in London He specializes in user interface development and has been working with Microsoft Surface, Silverlight, and WPF for the past four years Rob has a strong passion for learning new things and then teaching them to others He enjoys attending and presenting at NET user groups so much that he started the Canary Wharf NET User Group He plans to become a university professor “as soon as he gets sick of coding in the real world,” which isn’t going to happen soon Rob’s wife is an IOS developer, and together they have built and released a couple of successful iPhone games Now that his weekends are writing-free, he plans to churn out some awesome WP7 games, so watch your back Rob keeps a blog at www.robfe.com , and has a twitter account at www.twitter.com/robfe www.it-ebooks.info ffirs.indd vii 3/28/11 1:11:10 PM ACKNOWLEDGMENTS I WOULD LIKE TO THANK EVERYONE at Wrox who had a part in helping to get this book to print First, I would like to thank my family for supporting me on another book writing endeavor I would also like to take the time to thank Paul Reese for giving me the opportunity to work on another book project and Ginny Munroe, our primary editor, who fought to keep us all on track and on time, which was no easy task I would also like to thank Jonathan Marbutt, our technical editor, for checking all of our code and offering valuable input during the writing process Finally, I would also like to thank my co-authors, Karli and Robert, for their great work on this project and ensuring that all of the material will help our readers realize the goal of developing mobile applications on the new Windows Phone platform —Nick THANKS TO ALL AT WROX for their hard work in making my writing as good as it can be In no particular order, thanks especially to Paul Reese for getting things off the ground, Ginny for infi nite patience and good humour, and Kitty for her wordsmithing Also, thanks to my fellow authors, including many congratulations to Rob for getting through that “difficult fi rst book!” —Karli I COULD NEVER HAVE GOTTEN this far if not for my darling wife, Cara You’re inspirational, patient, and wonderful Thank you for all the support you give me Thanks to the staff at Wrox for all their support and patience, especially Ginny and Paul To all my mentors: Karli, Ben Gracewood, Dr Rick Mugridge, Dr Ewan Tempero, David Okey, Alan Goodison, and especially my parents — thank you for believing in me —Robert www.it-ebooks.info ffirs.indd viii 3/28/11 1:11:11 PM ... INTRODUCING WINDOWS PHONE The Windows Mobile Platform Here Comes the iPhone Android Arrives A Microsoft Reboot 2 The Windows Phone Platform Windows Phone Hardware Specifications Windows Phone Architecture... 3/28/11 1:11:06 PM Beginning Windows Phone Application Development: Building Windows Phone Applications Using Silverlight® and XNA® Published by Wiley Publishing, Inc 10 475 Crosspoint Boulevard... 349 350 351 351 358 362 371 CHAPTER 11: XNA FOR WINDOWS PHONE What Is XNA? An XNA Game: Tank 375 375 377 What’s in My Solution? The Game Class Running the Tank Game 378 379 383 Drawing 2-D Graphics

Ngày đăng: 06/03/2019, 11:01

Từ khóa liên quan

Mục lục

  • Content

    • Beginning Windows® Phone 7 Application Development: Building Windows® Phone Applications Using Silverlight® and XNA®

    • Contents

    • Introduction

    • Chapter 1: Introducing Windows Phone 7

      • The Windows Mobile Platform

        • Here Comes the iPhone

        • Android Arrives

        • A Microsoft Reboot

      • The Windows Phone 7 Platform

        • Windows Phone 7 Hardware Specifications

        • Windows Phone 7 Architecture

      • Getting Started with Windows Phone 7 Development

        • Navigating through Visual Studio 2010 Express Edition

      • Summary

    • Chapter 2: Jaw-Dropping Apps with the Help of Silverlight

      • Requirements for Windows Phone 7 Development

      • What Is Silverlight?

        • What Is XAML?

        • The Anatomy of a Windows Phone Application

        • Developing with Silverlight Controls

        • Common Control Properties

        • Layout Controls

        • Programming with Silverlight

        • Interactive Controls

      • Summary

    • Chapter 3: Spice up Your App with Shapes, Colors, Brushes, and Transforms

      • Working with Shapes

        • The Ellipse Control

        • The Rectangle Control

        • The Line Control

        • The Polygon Control

        • The Polyline Control

      • Working with Colors

      • Using Brushes

        • The SolidColorBrush Object

        • The LinearGradientBrush Object

        • The RadialGradientBrush Object

        • The ImageBrush Object

      • Applying Transforms

        • The RotateTransform Object

        • The ScaleTransform Object

        • The SkewTransform Control

        • The TranslateTransform Object

        • The TransformGroup Object

      • Summary

    • Chapter 4: Advanced User Interface Techniques: Styles, Templates, and the Visual State Manager

      • Understanding Control Styles

        • Application Styles

        • BasedOn Styles

        • Control Templates

        • The Visual State Manager

        • Expression Blend

        • User Controls

        • Custom Controls

      • Summary

    • Chapter 5: Isolated Storage, Page Navigation, and the Application Life Cycle

      • Isolated Storage

        • How Windows Phone 7 Data Storage Works

        • Getting Started Using Isolated Storage

        • The IsolatedStorageSettings Object

        • The IsolatedStorageFile Object

      • Using the Navigation Framework

        • Getting to Know the Navigation Framework

        • The NavigationService Class

        • Query Strings

        • Navigation Events

        • Page State

      • The Application Life Cycle

        • The Launching State

        • The Running State

        • The Closing State

        • The Deactivating State

        • The Activating State

      • Summary

    • Chapter 6: Interacting with the Hardware

      • What's Different about Mobile Device Application Development?

      • The Windows Phone 7 Hardware Specification

      • Altering Device Orientation

        • Configuring Supported Orientations

        • Responding to Orientation Changes

        • Device Orientation Best Practices

      • Understanding the Back Button

        • Taking Advantage of the Back Button's Functionality

        • Responding to the Back Button

      • Vibration

      • Tuning In to the FM Radio

      • Accelerating with the Accelerometer

        • The AccelerometerSensor Sensor

        • Simulating Accelerometer Data

      • Summary

    • Chapter 7: Launchers, Choosers, and Advanced User Input

      • Using the Application Bar

        • Adding an Application Bar

        • Application Bar Best Practices

      • Using Launchers and Choosers

        • An Overview of Launchers

        • An Overview of Choosers

        • Tombstoning

        • Working with Contacts

        • Making Voice Calls

        • Using Email and SMS Messaging

        • Interacting with the Camera

        • Using Other Launchers

      • The Software Input Panel (SIP)

        • Controlling the SIP

      • Using Multitouch

        • The Running State

        • The Closing State

        • The Deactivating State

        • The Activating State

      • Summary

    • Chapter 8: Windows Phone 7 Services and Cloud Services

      • What Are Services?

      • Finding Yourself with Location Services

        • Location Data Sources Overview and Comparison

        • Obtaining Location Information

        • Location Service Best Practices

      • Using Cloud Services

        • Using Microsoft Cloud Data

        • Using Bing Maps in a WP7 Application

      • Summary

    • Chapter 9: Creating and Consuming Web Services

      • Service Architecture Primer

        • HTTP

        • REST

        • WCF

      • Web Requests and Responses

        • Using WebClient

        • Using WebRequest and WebResponse

        • Cached Responses

      • REST-Based Services

        • Consuming a RESTful Service

        • Creating RESTful Services

      • WCF Services

        • Tools for Creating WCF Services

        • Hosting WCF Services

        • Creating WCF Services

        • WCF Services Example Application

        • WCF REST Services

      • Summary

    • Chapter 10: Web Services Push Notifications

      • Push Notification Architecture

        • Push Notification Components

        • Registering a Push Notification Service

        • Creating and Opening Notification Channels

        • Types of Push Notifications

      • Sending and Responding to Push Notifications

        • Creating and Configuring a Notification Channel

        • Sending Push Notification Service Messages

        • Creating a Push Notification Service

      • Summary

    • Chapter 11: XNA for Windows Phone 7

      • What Is XNA?

      • An XNA Game: Tank

        • What's in My Solution?

        • The Game Class

        • Running the Tank Game

      • Drawing 2-D Graphics

        • The SpriteBatch Class

        • The ContentManager Class

        • How to Draw Images

        • How to Draw Text

      • Updating Game State

        • The Versatility of Vectors

        • Keeping in Time

        • The TouchPanel Class

        • Driving the Tank

      • Simplifying Your Code with Game Components

        • The GameComponent and DrawableGameComponent Classes

        • GameComponent Life Cycles

      • More XNA Tips and Tricks

        • Handling Many Objects Efficiently

        • Playing Sounds

        • Advanced Geometry: Homing Missiles

        • Nonvisual Components

        • Detecting Collisions

        • Rendering Smooth Text with a Drop Shadow

      • Summary

    • Chapter 12: Microsoft Expression Blend

      • The Blend Interface

        • Using Blend's Tools and Panels

      • Creating Forms

        • Adding Layout Panels

        • Adding Controls

        • Editing Properties

        • Modifying Visual Design

      • Themes and Resources

        • Managing Resources

        • Reusing Code with Styles

        • Editing Control Templates

      • Animation

        • Managing Animations with Storyboards

        • Visual States

      • Data Binding in Blend

        • Binding to Datacontext

        • Binding to Elements

        • Putting Sample Data into the Blend Artboard

      • Summary

    • Chapter 13: Using the Silverlight for Windows Phonetoolkit and Creating Panoramic User Interfaces

      • Overview of the Silverlight for Windows Phone Toolkit

      • Silverlight for Windows Phone Toolkit Controls

        • The AutoCompleteBox Control

        • The DatePicker Control

        • The TimePicker Control

        • The ContextMenu Control

      • Silverlight for Windows Phone Toolkit Page Transitions

      • Silverlight for Windows Phone Toolkit Gestures

      • The Panorama Control

      • Summary

    • Chapter 14: Patterns, Frameworks, and Tests

      • Using Patterns

        • Using Architectural Patterns

        • Developing with MVVM

      • Using MVVM Frameworks

        • MVVM Framework Features

        • Finding the Right Framework

      • Adding Unit Tests

        • Manual Unit Testing

        • Unit Testing Frameworks

        • Mocking Dependencies

        • Unit Testing MVVM Applications

        • Test-Driven Development

      • Summary

    • Chapter 15: Publishing Your Application

      • The Marketplace and App Hub

      • Joining the App Hub

        • Completing the Identity Verification Process

        • Setting Up Payee Information

      • Submitting an Application for Publication

        • Uploading the XAP File

        • Describing the Application

        • Adding Artwork

        • Pricing Your Application

        • Submitting Your Application

      • Testing Your Application

      • Providing a Trial Mode

      • Increasing App Sales

        • Microsoft's Target Windows Phone 7 Market

        • Creating Impressions That Count

        • Getting the Word Out

        • The Right Price

        • Taking Advantage of Momentum

        • Obtaining Feedback

      • Summary

    • Appendix: Solutions to Exercises

    • Index

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan