developing an advanced windows phone 7.5 app that connects to the cloud

208 352 0
developing an advanced windows phone 7.5 app that connects to the cloud

Đ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

SPINE= .37” Developing Silverlight ® line of BuSineSS ApplicAtionS Developing Silverlight ® line of BuSineSS ApplicAtionS For more information explore: msdn.microsoft.com/practices Software Architecture and Software Development patterns & practices Proven practices for predictable results Save time and reduce risk on your software development projects by incorporating patterns & practices, Microsoft’s applied engineering guidance that includes both production quality source code and documentation. The guidance is designed to help software development teams: Make critical design and technology selection decisions by highlighting the appropriate solution architectures, technologies, and Microsoft products for common scenarios Understand the most important concepts needed for success by explaining the relevant patterns and prescribing the important practices Get started with a proven code base by providing thoroughly tested software and source that embodies Microsoft’s recommendations The patterns & practices team consists of experienced architects, developers, writers, and testers. We work openly with the developer community and industry experts, on every project, to ensure that some of the best minds in the industry have contributed to and reviewed the guidance as it is being developed. We also love our role as the bridge between the real world needs of our customers and the wide range of products and technologies that Microsoft provides. If you need to solve enterprise software development challenges such as validation, caching, logging, and exception handling in your Silverlight line-of- business applications, the Silverlight Integration Pack for Microsoft ® Enterprise Library 5.0 can help. It provides guidance and reusable Silverlight components designed to encapsulate recommended practices that facilitate consistency, ease of use, integration, and extensibility. It also helps you port your existing line-of-business applications that already use Enterprise Library to Silverlight. Note that the integration pack does not cover Silverlight for Windows Phone. This guide will help you make the most of the Silverlight Integration Pack for Enterprise Library 5.0 . It is focused on the desktop Silverlight platform and comes with an accompanying reference implementation to demonstrate how you can leverage Enterprise Library in a Silverlight application. It covers the Validation, Caching, Logging, Exception Handling, and Policy Injection Application Blocks. Developing An A DvAnceD WinDoWS ® phone 7.5 App thAt c onnectS to the clouD David Britch Francis Cheung Adam Kinney Rohit Sharma Each chapter contains an overview of an application block, various techniques for applying the block, and a description of how that block was applied in the reference implementation so you can begin realizing the benets of the Silverlight Integration Pack for Enterprise Library 5.0 . D  A W ® P . A  C   C Developing an Advanced Windows ® Phone 7.5 App that Connects to the Cloud David Britch Francis Cheung Adam Kinney Rohit Sharma 978-1-62114-015-3 This document is provided "as-is." Information and views expressed in this document, including URL and other Internet Web site references, may change without notice. Some examples depicted herein are provided for illustration only and are fictitious. No real association or connection is intended or should be inferred. This document does not provide you with any legal rights to any intellectual property in any Microsoft product. You may copy and use this document for your internal, reference purposes. © 2012 Microsoft. All rights reserved. Microsoft, Bing, Expression Blend, MSDN, Silverlight, Visual C#, Visual Studio, Windows, Windows Azure, and XNA are trademarks of the Microsoft group of companies. All other trademarks are property of their respective owners. Contents Contents v Foreword xi Acknowledgements xiii Acknowledgements on This 2nd Edition xv Preface xvii Who This Book Is For xvii Why This Book Is Pertinent Now xviii How This Book Is Structured xviii The Example Application xix What You Need to Use the Code xix Who’s Who xx Where to Go for More Information xxi 1 The Tailspin Scenario 1 The Tailspin Company 1 Tailspin’s Strategy 1 Tailspin’s Goals and Concerns 2 The Surveys Application Architecture 4 The Actors 5 Tailspin - The ISV 5 Fabrikam and Adatum - The Subscribers 5 The Surveyors - Windows Phone Users 5 The Business Model 6 The Application Components 6 vi 2 Building the Mobile Client 9 Overview of the Mobile Client Application 9 Goals and Requirements 9 Usability Goals 10 Non-Functional Goals 11 Development Process Goals 12 The Components of the Mobile Client Application 13 The Structure of the Tailspin Surveys Client Application 14 Dependency Injection 15 The TailSpin Solution 16 The Contents of the TailSpin.PhoneClient Project 17 The Contents of the TailSpin.PhoneClient.Adapters Project 17 The Contents of the TailSpin.PhoneServices Project 18 The Design of the User Interface 18 Page Navigation 18 User Interface Description 23 User Interface Elements 23 The Pivot Control 23 Styling and Control Templates 24 Context Menus 24 Using the Model-View-ViewModel Pattern 25 The Premise 25 Overview of MVVM 25 Benefits of MVVM 27 Connecting the View and the View Model 28 Inside the Implementation 28 Testing the Application 30 Inside the Implementation 30 Displaying Data 31 Inside the Implementation 32 Commands 42 Inside the Implementation 42 Handling Navigation Requests 44 Inside the Implementation 45 User Interface Notifications 49 Informational/Warning Notifications 50 Error Notifications 50 Inside the Implementation 50 Accessing Services 52 Conclusion 52 Questions 53 More Information 54 vii 3 Using Services on the Phone 55 The Model Classes 55 Using Isolated Storage on the Phone 56 Overview of the Solution 57 Security 58 Storage Format 58 Inside the Implementation 59 Application Settings 59 Survey Data 63 Handling Activation and Deactivation 67 Overview of the Solution 68 Inside the Implementation 69 Reactivation and the Pivot Control 77 Handling Asynchronous Interactions 78 Using Reactive Extensions 78 Inside the Implementation 79 Synchronizing Data between the Phone and the Cloud 83 Overview of the Solution 84 Automatic Synchronization 84 Manual Synchronization 85 Limitations of the Current Approach 86 Inside the Implementation 86 Automatic Synchronization 87 Manual Synchronization 93 Using Live Tiles on the Phone 97 Overview of the Solution 98 Inside the Implementation 98 The Application Tile 99 Secondary Tiles 101 Using Location Services on the Phone 103 Overview of the Solution 103 Inside the Implementation 104 Acquiring Image and Audio Data on the Phone 106 Overview of the Solution 106 Capturing Image Data 106 Recording Audio Data 107 Inside the Implementation 107 Capturing Image Data 107 Using XNA Interop to Record Audio 112 Logging Errors and Diagnostic Information on the Phone 115 Conclusion 116 Questions 116 More Information 117 viii 4 Connecting with Services 119 Authenticating with the Surveys Service 119 Goals and Requirements 120 Overview of the Solution 120 A Future Claims-Based Approach 122 Inside the Implementation 123 Notifying the Mobile Client of New Surveys 126 Overview of the Solution 127 Inside the Implementation 129 Registering for Notifications 129 Sending Notifications 136 Notification Payloads 140 Accessing Data in the Cloud 141 Goals and Requirements 141 Overview of the Solution 142 Exposing the Data in the Cloud 142 Data Formats 142 Consuming the Data 142 Using SSL 143 Inside the Implementation 143 Creating a WCF REST Service in the Cloud 143 Consuming the Data in the Windows Phone Client Application 146 Filtering Data 150 Overview of the Solution 150 Registering User Preferences 151 Identifying Which Devices to Notify 153 Selecting Surveys to Synchronize 154 Inside the Implementation 155 Storing Filter Data 155 Building a List of Devices to Receive Notifications 157 Building a List of Surveys to Synchronize with the Mobile Client 158 Conclusion 159 Questions 159 More Information 160 Appendix A: Unit Testing Windows Phone Applications 161 Windows Phone 7.1 SDK Abstractions 162 Mock Implementations 163 Testing Asynchronous Functionality 164 Using Delegates to Specify Behavior 165 Running Unit Tests 166 ix Appendix B: Prism Library for Windows Phone 167 About Prism for Windows Phone 168 Contents of Prism for Windows Phone Library 168 Microsoft.Practices.Prism Namespace 169 Microsoft.Practices.Prism.Commands Namespace 169 Microsoft.Practices.Prism.Events Namespace 170 Microsoft.Practices.Prism.ViewModel Namespace 170 Microsoft.Practices.Prism.Interactivity Namespace 171 Microsoft.Practices.Prism.Interactivity.InteractionRequest Namespace 172 Answers to Questions 173 Chapter 2, Building the Mobile Client 173 Chapter 3, Using Services on the Phone 175 Chapter 4, Connecting with Services 178 Index 181 [...]... you to see just the Windows Phone client or the combined Windows Phone and Windows Azure applicaFigure 1 tion If you want to try only the Windows Phone client, The book structure you can run the simplified version of the application that uses mock service implementations to provide the data required by the client application You do not need to install the Windows Azure run-time environment and the Windows. .. Silverlight® for Windows Phone Toolkit Follow other Windows Phone UI guidelines, such as those on the use of the hardware Back button and the behavior of the application when the user answers a call or switches to another application The Back button navigates backward in a way that matches the user’s expectations The application restores the UI to its previous state after the user finishes answering an incoming... for applications on a Windows Phone device The following table lists some examples Goal Description Example Take advantage of the appearance and behavior of the Windows Phone platform The application accepts standard input gestures for users to enter data, uses the standard system colors, and includes icons designed to match the phone s theme The application can update its appearance to blend with the. .. client application for Windows Phone that enables users to register for and download surveys, complete the surveys, and upload the results to the cloud- based service It includes details of the overall structure of the application, the way that the Model-View-ViewModel (MVVM) pattern is implemented, and the way that the application displays data and manages commands and navigation between the pages The. .. from the Tailspin back end and for uploading completed survey data To enable the Windows Phone application to communicate with the back end, the cloud components include an API that exposes the functionality that the mobile client application requires Tailspin uses Windows Communication Foundation (WCF) REST to transport the data over the network The Windows Phone application also authenticates with the. .. Studio, to write their applications In addition, the Windows Phone 7.1 SDK provides a complete emulation environment and additional tools specially tailored for developing Windows Phone applications Developers can use these tools to write, test, and debug their applications locally before they deploy them to a real device for final testing and acceptance This book shows you how to use these tools in the. .. with Windows Phone as a platform, and were confident of their abilities to build the Surveys mobile client application for Windows Phone OS 7.1 However, the developers first had to understand the capabilities of Windows Phone OS 7.1 in order to determine how best to architect and design both the mobile client application and the elements of the application in the cloud The Ta ilspin Scena r io There...Foreword The release of Windows Phone 7, and the Windows Phone 7.0 SDK, provided great opportunities for building highly interactive and immersive applications However, with the release of Windows Phone 7.5, and the Windows Phone 7.1 SDK, it is now possible to build many classes of applications that it was not previously possible to build This release expands upon the capabilities of the Windows Phone. .. Integrate with the phone capabilities The application uses the location services on the phone to establish its geographical location, and it uses the camera and microphone to collect data for some survey questions Handle changes in screen orientation The application automatically updates the display orientation when the user changes the phone s orientation Handle standard screen resolutions The application... the phone s standard Light and Dark themes For more information, see the ThemedResourceLocator class in the Resources folder Use the standard controls Windows Phone users are familiar with The application uses standard controls, including the ApplicationBar, and Pivot controls, to make the user feel at home and to minimize the learning curve In addition, the application also uses controls from the . Services 52 Conclusion 52 Questions 53 More Information 54 vii 3 Using Services on the Phone 55 The Model Classes 55 Using Isolated Storage on the Phone 56 Overview of the Solution 57 Security 58 Storage. Goals and Concerns 2 The Surveys Application Architecture 4 The Actors 5 Tailspin - The ISV 5 Fabrikam and Adatum - The Subscribers 5 The Surveyors - Windows Phone Users 5 The Business Model 6 The. C   C Developing an Advanced Windows ® Phone 7. 5 App that Connects to the Cloud David Britch Francis Cheung Adam Kinney Rohit Sharma 978 -1-62114-0 15- 3 This document is provided

Ngày đăng: 20/10/2014, 14:05

Từ khóa liên quan

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

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

Tài liệu liên quan