Windows Phone 7 for iPhone Developers
Kevin Hoffman
![800 East 96th Street Indianapolis Indiana 46240 USA Windows Phone 7 for - photo 1](/uploads/posts/book/27438/graphics/pub.jpg)
800 East 96th Street, Indianapolis, Indiana 46240 USA
Windows Phone 7 for iPhone Developers
Copyright 2012 by Pearson Education, Inc.
All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein.
ISBN-13: 978-0-672-33434-4
ISBN-10: 0-672-33434-8
Editor-in-Chief
Greg Wiegand
Executive Editor
Neil Rowe
Development Editor
Mark Renfrow
Managing Editor
Kristy Hart
Project Editors
Jovana San
Nicolas-Shirley and Elaine Wiley
Copy Editor
Barbara Hacha
Indexer
Lisa Stumpf
Proofreader
Seth Kerney
Technical Editors
Bruce Johnson
Nate Dudek
Publishing Coordinator
Cindy Teeters
Cover Designer
Gary Adair
Senior Compositor
Gloria Schurick
Library of Congress cataloging-in-publication data is on file.
Printed in the United States of America
First Printing: August 2011
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Pearson Education, Inc. cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an as is basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book.
Bulk Sales
Pearson offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales. For more information, please contact:
U.S. Corporate and Government Sales
1-800-382-3419
For sales outside of the U.S., please contact:
International Sales
+1-317-581-3793
I want to dedicate this book to the women in my life:
Angelica, Isabella, and Jerrah.
Behind every good man is an even better woman, and
behind every good author is a woman with the patience of
a saint and a perpetually running coffeemaker.
About the Author
Kevin Hoffman (Windsor, CT) is an enterprise programmer who has extensive experience with both Windows Phone 7/Windows Mobile and Apples iPhone platforms. Currently chief systems architect for Oakleaf Waste Management, he specializes in mobile and cloud development. He writes The .NET Addicts Blog, served as editor-in-chief of iPhone Developers Journal, presented twice at Apples World Wide Developers Conference, and has authored and co-authored several books, including WPF Control Development Unleashed: Building Advanced User Experiences and ASP.NET 4 Unleashed.
Acknowledgments
Thanks also go to the staff at Pearson, in particular to Neil Rowe, who has impeccable taste in beer and has somehow managed to put up with me for years.
We Want to Hear from You!
As the reader of this book, you are our most important critic and commentator. We value your opinion and want to know what were doing right, what we could do better, what areas youd like to see us publish in, and any other words of wisdom youre willing to pass our way.
You can email or write me directly to let me know what you did or didnt like about this bookas well as what we can do to make our books stronger.
Please note that I cannot help you with technical problems related to the topic of this book, and that due to the high volume of mail I receive, I might not be able to reply to every message.
When you write, please be sure to include this books title and author as well as your name and phone or email address. I will carefully review your comments and share them with the author and editors who worked on the book.
Email:
Mail: Neil Rowe
Executive Editor
Sams Publishing
800 East 96th Street
Indianapolis, IN 46240 USA
Reader Services
Visit our website and register this book at informit.com/register for convenient access to any updates, downloads, or errata that might be available for this book.
1. Introduction
Twenty years from now you will be more disappointed by the things you didnt do than by the ones you did do. So throw off the bowlines. Sail away from the safe harbor. Catch the trade winds in your sails. Explore. Dream. Discover.
Mark Twain
This chapter provides you with a brief introduction to the material that will be presented in this book, as well as some insight into the writing style, how best to read this book, and more. Hopefully, after reading this introduction, you will know whether you want to continue reading this book or skip it and go find the latest book in the Twilight series in another section of the bookstore.
I know that its hard for a book about mobile device programming to compete with angst-ridden vampires in love, but there is a tremendous amount of extremely good information in this book. This isnt just another reference guide. In addition to all the code samples, comparisons between iOS and WP7, and tutorials, I also try to provide as much insight as possible based on my experience building applications for both platforms. If you squint hard enough and cross your eyes while reading, you might learn a few useful patterns, tips, or tricks. If you manage to read all the way to the end, you might even learn how to survive the zombie apocalypse, or at least learn how to write some software that will help you and your Windows Phone survive it.
Who Are You and Why Should I Care?
Ive been writing mobile applications for a long time. One of the first truly mobile applications I wrote was an app that ran on a PalmOS Symbol Barcode reader that could be used by people in warehouses to scan products on shelves. Once plugged back into a workstation (if youre wondering if I really am old enough to pre-date Wi-Fi, you are correct, and no, I do not have an 8-track player in my car), the app would then check an inventory system that maintained level information of hazardous materials.
After my tour of duty with PalmOS, I spent some time in the PocketPC/Windows CE realm writing applications for form factors of all shapes and sizes, even tablet PCs before they became hip and trendy. More recently I wrote code for Windows Mobile using the .NET Compact Framework. Eventually the iPhone came out and I started writing code for the iPhone and, obviously, I have since become hopelessly addicted to building applications for Windows Phone 7.
In addition to writing code for mobile platforms, Ive been writing and co-writing books on virtually all aspects of the .NET Framework for the past 10 years, since before .NET 1.0 was released to the general public. I spoke at Apples Worldwide Developer Conference (WWDC) two years in a row. The first time I compared the developer experience of building apps with Windows Presentation Foundation (WPF) with desktop application development using Cocoa for the Mac. The next year, I compared the .NET Compact Framework to the first release of the iPhone SDK.