Beginning Windows Phone App Development docx

538 8.6K 0
Beginning Windows Phone App Development docx

Đ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 For your convenience Apress has placed some of the front matter material after the index. Please use the Bookmarks and Contents at a Glance links to access them. www.it-ebooks.info iv Contents at a Glance  About the Authors xviii  About the Technical Reviewer xix  Acknowledgments xx  Introduction xxi  Chapter 1: Introducing Windows Phone and the Windows Phone Platform 1  Chapter 2: Building Windows Phone Applications 15  Chapter 3: Building Windows Phone 7 Applications Using Cloud Services As Data Stores 37  Chapter 4: Catching and Debugging Errors 103  Chapter 5: Packaging, Publishing, and Managing Applications 129  Chapter 6: Working with the Accelerometer 151  Chapter 7: Application Bar 171  Chapter 8: The WebBrowser Control 193  Chapter 9: Working with Controls and Themes 213  Chapter 10: Integrating Applications with the Windows Phone OS 235  Chapter 11: Creating Trial Applications 265  Chapter 12: Internationalization 287  Chapter 13: Isolated Storage 311  Chapter 14: Using Location Services 329  Chapter 15: Media 357 www.it-ebooks.info v  Chapter 16: Working with the Camera and Photos 379  Chapter 17: Push Notifications 405  Chapter 18: Reactive Extensions for .NET 445  Chapter 19: Security 479  Index 513 www.it-ebooks.info xxi Introduction This is the third edition of this book. We wanted to improve upon the first two editions and update the book with new features of the Windows Phone OS, as well as provide hands-on knowledge on how to program the plethora of features offered by Windows Phone devices. While the second edition was being written, Microsoft and Nokia formally announced their partnership and signed an agreement to seal their commitment. While we were writing the third edition, Nokia phones were being released to the European markets, and they should be coming to the United States in days. We hope that this book will provide developers with the practical knowledge that we gained by developing real-world applications; we also hope it will inspire developers to create many cool applications for the Windows Phone platform. Who This Book Is For This book assumes that you have basic C# and .NET knowledge. This book will provide you with basic fundamentals and skills that you need to be successful in developing Windows Phone applications. You don’t need previous experience developing mobile applications—the only thing you need is a desire to learn new technology. What You Need to Use This Book In order to write Windows Phone applications and test out the examples in this book, you’ll need to download the tools listed here. All of these are available at no charge from Microsoft. You’ll find additional information on how to install and use these tools in Part 1 of this book. • Windows Phone Developer Tools RTW: http://download.microsoft.com/download/ 1/7/7/177D6AF8-17FA-40E7-AB53-00B7CED31729/vm_web.exe • Zune software: www.zune.net/en-us/products/software/download/ • User Experience Design Guidelines for Windows Phone: http://go.microsoft.com/fwlink/?LinkID=183218 • Windows Phone 7 Marketplace Certification Requirements: http://go.microsoft.com/?linkid=9730558 • Microsoft SQL Server 2008 R2 Express: www.microsoft.com/express/Database/ • Azure Tools for Visual Studio 1.2 June 2010: http://download.microsoft.com/ DOWNLOAD/1/F/9/1F96D60F-EBE9-44CB-BD58-88C2EC14929E/VSCLOUDSERVICE.EXE www.it-ebooks.info  INTRODUCTION xxii • Azure SDK (June 2010): http://www.microsoft.com/windowsazure/sdk/ • Windows Azure Platform Training Kit: http://www.microsoft.com/downloads/en/ details.aspx?familyid=413e88f8-5966-4a83-b309-53b7b77edf78 How This Book Is Organized This book contains 19 chapters, broken into 2 major parts. In Part 1, we will walk you through the development life cycle of the application. You will go from coding the simplest possible Hello World– style Windows Phone 7 application to building a full-blown, modern n-tier application that uses both the Windows Phone development platform and the unique cloud services that support it. The section concludes with step-by-step instructions on how to gain certification from Microsoft and offer an application to the public through the Windows Phone Marketplace. In Part 2, you will learn how to use specific features of Windows Phone devices in your applications, including the accelerometer, location services, the Application Bar, reactive extensions, application hub integration, application life cycle events, Isolated Storage, Silverlight, XAML, skinning controls, web browser controls, media elements, photos, push notifications, internalization, and security. While each of its chapters is a tutorial, you can also use Part 2 as a reference. Each chapter focuses on a single phone feature and provides step-by-step instructions on how to incorporate it into your application. Where to Find Sources for the Examples The source code of all of the examples is available at www.apress.com/ or http://wp7apress.codeplex.com. Send Us Your Comments We value your input. We’d like to know what you like about the book and what you don’t like about it. When providing feedback, please make sure you include the title of the book in your note to us. We’ve tried to make this book as error-free as possible. However, mistakes happen. If you find any type of error in this book, whether it is a typo or an erroneous command, please let us know about it. Visit the book’s web page at www.apress.com/9781430235965 and click the Errata tab. Your information will be validated and posted on the errata page to be used in subsequent editions of the book. Contacting the Authors You can contact us directly at the following e-mail addresses: Henry Lee: Henry.Lee@NewAgeSolution.net Eugene Chuvyrov: echuvyrov@msn.com www.it-ebooks.info C H A P T E R 1 1 Introducing Windows Phone and the Windows Phone Platform This is an exciting time for mobile app developers as the smartphone race heats up between the major players: Microsoft Windows Phone, Apple iPhone, and Google Android. As a developer, you are faced with an amazing opportunity to develop a mobile application that can be sold to millions of consumers worldwide using any of these platforms. Gartner predicts that by 2014 the smartphone market will boom, and there will be billions of dollars at stake. Recently, Nokia, one of the largest mobile phone makers in the world, announced that it will replace its Symbian-based operating system with the Windows Phone OS. The partnership between Microsoft and Nokia will potentially boost Windows Phone’s global market share to 30 percent, making it even more attractive for Windows Phone developers. The Windows Phone Marketplace, where consumers can purchase applications, opened in November 2010. You might consider downloading Zune software from www.zune.net/en- US/products/software/download/downloadsoftware.htm to view the current Marketplace, or you can navigate on your browser to www.windowsphone.com/en-US/marketplace. Once you have downloaded the Zune software and fired it up, click the Marketplace APPS links, and you will be able to see all the Windows Phone applications currently published, as shown in Figure 1-1. You will learn more about the Marketplace in Chapter 5. www.it-ebooks.info CHAPTER 1  INTRODUCING WINDOWS PHONE AND THE WINDOWS PHONE PLATFORM 2 Figure 1-1. Windows Phone Marketplace There are hundreds of ideas for applications waiting to be discovered and developed by people like you. Take a look at Simply Solitaire, QuotedSuccess, DuckCaller, and the mobile baseball game shown in Figure 1-2. Which of these will be among the first Windows Phone hits to catch fire with consumers and sell millions of units? www.it-ebooks.info CHAPTER 1  INTRODUCING WINDOWS PHONE AND THE WINDOWS PHONE PLATFORM 3 Figure 1-2. Windows Phone applications www.it-ebooks.info CHAPTER 1  INTRODUCING WINDOWS PHONE AND THE WINDOWS PHONE PLATFORM 4 What application will you be developing? We’ve written this book to guide you through the steps it takes to write and launch a successful application to the Windows Phone Marketplace. So what are you waiting for? Let’s get started by diving into what Windows Phone offers to developers like you. Windows Phone Overview Microsoft Windows Phone is a great mobile platform because it offers all of the modern smartphone features, including GPS, e-mail, SMS, a camera, and a music player, and it also provides an easy-to-use development framework that allows millions of .NET developers to learn and develop on Windows Phone quickly. Also, Windows Phone offers multitouch screen capability, a beautiful user interface (UI) that implements a new modern design called Metro, social networking services such as Facebook, and support for popular e-mail services such as Yahoo, Hotmail, Gmail, and AOL (and, if you’re a corporate user, Microsoft Exchange). Moreover, the platform ships with a version of Microsoft Office—a unique feature of Windows Phone. You can use this version of Office to read, edit, save, and sync Word, Excel, and other Office files. This makes Windows Phone a great mobile platform for those who use Office at home or at work. Windows Phone can also integrate with Xbox LIVE, making it a great choice for gamers. Microsoft Windows Phone uses the Zune software to sync installed applications, pictures, and music, and back up and flash OS updates. As a developer, you’ll also use Zune in conjunction with Visual Studio to debug your applications on a real device; more on that in Chapter 4. Microsoft also introduces the concept of a hub with the Windows Phone—a People hub where users can store all of their contacts and social networking connections; a Music hub where consumers can listen to, download, and purchase music; and an App hub, also known as the Marketplace, where you will publish the applications you create. Having a smartphone that’s a hit with consumers is important because the consumer marketplace is where the greatest opportunities lie. One of the great things about Windows Phone is that Microsoft imposes the hardware specifications on the phone manufacturer, making it easy for you to develop an application without worrying about writing device-specific code. For any future release of Windows Phone, you are guaranteed that the application you write today will work regardless of the brand of the mobile device, as long as it runs Microsoft Windows Phone. Naturally, you want to know what language you’ll need to master for your work. For Windows Phone, the languages of choice today are C# and Visual Basic—the primary .NET languages. As for an application development framework, you have two choices: Silverlight or XNA. Silverlight and XNA both use the core .NET Framework. You will learn more about the two frameworks later in this chapter, but first let’s take a closer look at the hardware features you can expect on a Windows Phone device. Windows Phone Hardware Specifications Knowing what’s included in the Microsoft Windows Phone hardware specifications will help you prepare for the special needs of the projects you will undertake. Table 1-1 lists the minimum hardware requirements that any Windows Phone manufacturer must meet, and it also includes suggestions as to how they can impact developers like you. www.it-ebooks.info [...]... subsequently ported to Windows Phone Once you have installed the Windows Phone developer tools, you can start to build your first Windows Phone application 15 www.it-ebooks.info CHAPTER 2  BUILDING WINDOWS PHONE APPLICATIONS Building Your First Windows Phone Application In this section, you’ll build a simple Hello World application using the Silverlight framework Creating the application will provide... INTRODUCING WINDOWS PHONE AND THE WINDOWS PHONE PLATFORM Application Development Life Cycle It’s important to understand the application development life cycle helps you prepare for it In-depth discussion of the application development life cycle, including the certification process, is provided in Chapter 5 Figure 1-6 shows a high-level view of the development life cycle of a Windows Phone application... more Windows Phone devices You can find more information on the release of new Windows phones at www.microsoft.com/windowsphone/en-us/buy/7/phones.aspx In the next section, you will learn how the software behind these powerful consumer smartphones provides a great platform for developers Windows Phone Application Platform Microsoft did not invent any new languages or frameworks for the Windows Phone application... Windows Phone controls 13 www.it-ebooks.info CHAPTER 2 Building Windows Phone Applications This chapter will prepare you with everything you need to get started with Windows Phone development You will learn about the Windows Phone emulator, Visual Studio 2010 Express, and Microsoft Expression Blend 4 You will use these tools to create your first Windows Phone application Before you can write your first application,... work as well • The Windows Phone emulator: This is used to run and test the Windows Phone application • Silverlight for Windows Phone: This is the Silverlight framework for Windows Phone, based on Silverlight 3 technology See Chapter 1 for a description of the subtle differences between Silverlight 3 and the Windows Phone Silverlight framework • Microsoft Expression Blend for Windows Phone: This tool... to ask questions related to Silverlight for Windows Phone If you have other Windows Phone related questions, you can visit http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series The Windows Phone development team puts out many useful blogs that you can follow at http://windowsteamblog.com /windows_ phone/ b/wpdev/ Of course, there is Windows Phone documentation at MSDN; go to http://msdn.microsoft.com/en-us/library/ff402535(VS.92).aspx... and animations to Expression Blend 8 www.it-ebooks.info CHAPTER 1  INTRODUCING WINDOWS PHONE AND THE WINDOWS PHONE PLATFORM Figure 1-4 Microsoft Expression Blend 4 for Windows Phone Windows Phone Emulator The Windows Phone emulator, shown in Figure 1-5, is integrated with Visual Studio, and it simulates a real Windows Phone device However, there are things that you can’t do in the emulator For instance,... template is a template for one-page applications The Windows Phone List Application template uses a ListBox control and page navigation framework to create applications with multiple pages The Windows Phone Class Library template can be used to create a class library that can be referenced by other Windows Phone projects 17 www.it-ebooks.info CHAPTER 2  BUILDING WINDOWS PHONE APPLICATIONS 4 For the purposes... advantage of these services in your applications as well; however, this topic is beyond the scope of this book You learned a bit about Windows Phone and the Windows Phone platform in the previous sections In the following sections and in the rest of this book, you will learn about Windows Phone application development Metro Design Microsoft is targeting Windows Phone toward busy professionals In order... BUILDING WINDOWS PHONE APPLICATIONS Figure 2-1 Creating a new project in Visual Studio 2010 Express 3 From among the three C# templates that Visual Studio 2010 Express displays on its New Project dialog page, select the Windows Phone Application Visual C# template, as shown in Figure 2-2  Note There are three different Windows Phone Visual Studio 2010 Express project templates The Windows Phone Application . Introducing Windows Phone and the Windows Phone Platform 1  Chapter 2: Building Windows Phone Applications 15  Chapter 3: Building Windows Phone 7 Applications. INTRODUCING WINDOWS PHONE AND THE WINDOWS PHONE PLATFORM 9 Figure 1-4. Microsoft Expression Blend 4 for Windows Phone Windows Phone Emulator The Windows Phone

Ngày đăng: 08/03/2014, 02:20

Từ khóa liên quan

Mục lục

  • Cover

    • Contents at a Glance

    • Contents

    • About the Authors

    • About the Technical Reviewer

    • Acknowledgments

    • Introduction

    • Introducing Windows Phone and the Windows Phone Platform

      • Windows Phone Overview

      • Windows Phone Hardware Specifications

      • Windows Phone Application Platform

        • Silverlight for Windows Phone

        • XNA for Windows Phone

        • Tools

          • Visual Studio

          • Expression Blend

          • Windows Phone Emulator

          • Documentation and Support

          • Cloud Services

          • Metro Design

          • Application Development Life Cycle

          • Summary

          • Building Windows Phone Applications

            • Preparing Your Development Machine

            • Building Your First Windows Phone Application

              • Creating a Windows Phone Project

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

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

Tài liệu liên quan