Windows Phone 8 Unleashed

Overview

Windows® Phone 8 Unleashed is the definitive guide to Microsoft’s new Windows Phone 8 platform for intermediate to advanced developers. Written by Microsoft MVP and leading Windows Phone and WPF innovator Daniel Vaughan, this full-color guide covers everything developers need to rapidly build highly competitive Windows Phone 8 mobile apps.

Vaughan teaches through complete sample apps—leveraging the MVVM pattern—illuminating each key concept with fully explained code and ...

See more details below
Paperback
$38.63
BN.com price
(Save 35%)$59.99 List Price

Pick Up In Store

Reserve and pick up in 60 minutes at your local store

Other sellers (Paperback)
  • All (14) from $33.12   
  • New (11) from $33.12   
  • Used (3) from $38.62   
Windows Phone 8 Unleashed

Available on NOOK devices and apps  
  • NOOK Devices
  • NOOK HD/HD+ Tablet
  • NOOK
  • NOOK Color
  • NOOK Tablet
  • Tablet/Phone
  • NOOK for Windows 8 Tablet
  • NOOK for iOS
  • NOOK for Android
  • NOOK Kids for iPad
  • PC/Mac
  • NOOK for Windows 8
  • NOOK for PC
  • NOOK for Mac
  • NOOK Study

Want a NOOK? Explore Now

NOOK Book (eBook)
$27.49
BN.com price
(Save 42%)$47.99 List Price

Overview

Windows® Phone 8 Unleashed is the definitive guide to Microsoft’s new Windows Phone 8 platform for intermediate to advanced developers. Written by Microsoft MVP and leading Windows Phone and WPF innovator Daniel Vaughan, this full-color guide covers everything developers need to rapidly build highly competitive Windows Phone 8 mobile apps.

Vaughan teaches through complete sample apps—leveraging the MVVM pattern—illuminating each key concept with fully explained code and real-world context. He presents best practices for building highly functional, maintainable, and attractive mobile interfaces; integrating touch, rich media, and data; testing; profiling; and more.

Expanded and updated, Vaughan shares expert insights available in no other book, drawing on his exceptional access to the Windows Phone development team through the elite Microsoft Silverlight and WPF Insiders group. Along the way, he presents exceptionally practical and thorough coverage of many powerful new Windows Phone 8 platform enhancements, including full chapters on voice commands and speech synthesis, incorporating speech-driven experiences, Wallet integration, new Live Tile capabilities, the Nokia Maps control, launching apps via file and protocol associations, and much more.

Detailed information on how to…

* Get started quickly with Windows Phone XAML development in Visual Studio

* Master the Capabilities Model, threading, and the Execution Model

* Create attractive mobile interfaces using Windows Phone’s rich set of controls, including the Windows Phone Toolkit

* Make the most of the application bar and other interface elements

* Enhance user experience with advanced support for touch, gestures, and sensors

* Build location-aware apps that use Nokia Maps and location services

* Incorporate speech-driven experiences

* Quickly internationalize apps for global markets

* Leverage Windows Phone 8’s improved camera support

* Connect apps to online services via SOAP, REST, and OData

* Validate user input on the client side or via WCF services

* Use Windows Phone 8’s powerful local database support

* Implement background actions, file transfers, and audio playback

* Automatically launch your app using file and protocol associations

* Unit test to find defects earlier, saving time and money

Read More Show Less

Editorial Reviews

From the Publisher
"With its attention to detail and its extensive content, it’s hard to resist the conclusion that it’s likely to remain the Windows Phone app developers bible for quite some time to come." -- Ron H. Ikeda, Denver Visual Studio User Group Member Source: http://www.denvervisualstudio.net/Reviews/Books2013/Book07302013.htm
Read More Show Less

Product Details

  • ISBN-13: 9780672336898
  • Publisher: Sams
  • Publication date: 5/29/2013
  • Series: Unleashed Series
  • Edition number: 1
  • Pages: 1123
  • Sales rank: 402,810
  • Product dimensions: 7.12 (w) x 8.98 (h) x 1.50 (d)

Meet the Author

Daniel Vaughan is cofounder of Outcoder, a Swiss software and consulting company dedicated to creating best-of-breed connected user experiences and leading-edge back-end solutions, using the Microsoft stack of technologies—in particular WPF, Windows 8, WinRT, Silverlight, and Windows Phone.

Daniel is a Microsoft MVP for Client Application Development, with commercial experience across a wide range of industries, including finance, e-commerce, and multimedia. Daniel is a Silverlight and WPF Insider, a member of the elite WPF Disciples group, a three-time CodeProject MVP, and is a member of the Microsoft Developer Guidance Advisory Council.

He is a technical advisory board member of PebbleAge, a Swiss finance company specializing in business process management.

He also is the creator of a number of open source projects, including Calcium and Clog.

Daniel blogs at http://danielvaughan.org, where he publishes articles and software prototypes. You also can catch Daniel on Twitter at @dbvaughan.

Daniel has a degree in Computer Science from UNE, where he received various awards, including twice the annual School of Mathematics, Statistics and Computer Science Prize, and the Thomas Arnold Burr Memorial Prize in Mathematics.

With his wife, Daniel runs the Windows Phone Experts group on LinkedIn at http://linkd.in/jnFoqE.

Originally from Australia and the UK, Daniel is based in Zurich, Switzerland, where he lives with his wife, Katka, and son Bertie.

Read More Show Less

Table of Contents

Preface xxii

Part I Windows Phone App Development Fundamentals

Chapter 1 Introduction to Windows Phone App Development 1

Installing the Windows Phone SDK........................................................2

Creating Your First XAML for Windows Phone App.................................2

The Application Class..................................................................7

Summary...........................................................................................11

Chapter 2 Fundamental Concepts in Windows Phone Development 13

Understanding the Role of XAP Files....................................................14

The Application Deployment Tool...............................................15

The Windows Phone Capabilities Model...............................................16

Determining App Capabilities Using the Marketplace Test Kit.........17

The Threading Model for XAML-Based Graphics and Animation in Windows Phone...........................................................................18

Performance and Element Visibility..............................................19

Deciding Between Visibility and Opacity......................................20

Understanding the Frame Rate Counter................................................20

The Windows Phone Application Analysis Tool.....................................22

External Events..........................................................................25

Frame Rate Graph.......................................................................25

CPU Usage Graph.......................................................................25

Memory Usage MB Graph...........................................................26

Storyboards................................................................................26

Image Loads...............................................................................26

GC Events..................................................................................26

Viewing Detailed Profiling Information........................................26

Reading Device Information................................................................27

Calculating Available Memory.....................................................28

DeviceStatus Events...................................................................29

Applying the Model-View-ViewModel Pattern to a Windows Phone App......31

Implementing the MVVM Pattern................................................31

ViewModelBase Class...................................................................32

Property Change Notification..............................................................33

Implementing INotifyPropertyChanged: The Traditional Approach.........33

Implementing INotifyPropertyChanged: An Alternative Approach..........35

Using Commands...............................................................................38

Argument Validation..........................................................................39

A Platform-Agnostic Dialog Service.......................................................41

Consuming Local Web Applications.....................................................44

Summary...........................................................................................46

Chapter 3 Understanding the Application Execution Model 47

Exploring the Execution Model............................................................48

Application State........................................................................49

Life Cycle Events........................................................................49

Programmatically Exiting an App.................................................53

Saving Transient State.................................................................53

Restoring Transient State.............................................................55

Saving Persistent State.................................................................56

Implementing Fast App Resume...........................................................56

Enabling Fast App Resume...........................................................56

Optimizing the Resume Experience..............................................57

Running Under the Lock Screen...........................................................63

Lock Screen Management............................................................64

Page Navigation..................................................................................67

Navigation Using Unmapped URIs...............................................69

Passing Page Arguments Using Query Strings................................71

URI Mapping.............................................................................73

Navigation Using the NavigationService.....................................75

Handling Page Navigation...........................................................76

Canceling Navigation.................................................................77

Cross-Page Communication.........................................................77

Page Redirection.........................................................................78

Hardware Back Button................................................................79

Creating an Application Splash Screen..................................................80

Walking Through the Bookshop Sample Application.............................83

Displaying the Product List..........................................................86

Design-Time Data.......................................................................92

Image Caching...........................................................................93

Overview of the Sample Bookshop WCF Service............................95

Summary...........................................................................................97

Chapter 4 Controlling Page Orientation 99

Orientation and the PhoneApplicationPage Class..................................99

OrientationChanged Event.........................................................100

PhoneApplicationPage Orientation Property...............................102

Setting Page Orientation at Runtime...........................................105

Animating Page Elements When the Page Orientation Changes.....106

Animating the Entire Page When Orientation Changes.................108

Windows Phone Toolkit Animated Page Transitions.............................110

Using Windows Phone Toolkit Transitions..................................111

Reusing the Transition Attached Properties..................................113

Summary...................................................................................114

Part II Essential Elements

Chapter 5 Using Content Controls, Items Controls, and Range Controls 115

Control Type Taxonomy....................................................................116

Identifying Controls Not Supported or Absent in Windows Phone.........118

Content Controls...............................................................................119

Defining the Default Content Property........................................120

Receiving Input with Buttons..............................................................121

Tap and Click Events.................................................................123

Button Click Mode....................................................................124

Hyperlink Button......................................................................124

Repeat and Toggle Buttons.........................................................124

Radio Button.............................................................................128

Check Box................................................................................131

ToolTip....................................................................................138

Items Controls............................................................................138

ListBox....................................................................................140

ComboBox................................................................................142

Range Controls............................................................................142

ProgressBar..............................................................................144

Progress Indicator......................................................................145

Slider......................................................................................151

ScrollBar.................................................................................152

Summary....................................................................................152

Chapter 6 Mastering Text Elements and Fonts 153

Understanding Text Element Types.....................................................154

Displaying Text Using the TextBlock...................................................155

Using the Run and LineBreak Objects..........................................155

Multiline TextBlock Text...........................................................158

Controlling Font Properties................................................................158

Understanding the Built-In Fonts........................................................160

Using Third-Party Fonts via Font Embedding.......................................162

Leveraging FontSource to Assign a Font Using a Stream................164

Receiving Input Using a TextBox.........................................................165

Software Input Panel..................................................................165

Input Scope...............................................................................168

Input Scope Sample Overview.....................................................169

Receiving Password Text Using a PasswordBox......................................175

Displaying Rich Content Using a RichTextBox.....................................176

Formatting Text at Runtime.......................................................178

Further Reading.........................................................................179

Placing Text on the Clipboard............................................................179

Summary.....................................................................180

Chapter 7 Employing Media and Web Elements 183

Displaying Images with the Image Element..........................................184

Image Sizing.............................................................................185

Providing a Drawing Surface with the InkPresenter Element................186

Capturing User Input.................................................................188

InkPresenter Sample Code........................................................190

Playing Audio and Video with the MediaElement..................................193

MediaElement Sample Code........................................................194

XNA SoundEffect Class..............................................................201

Harnessing the XNA Game Loop Via the GameTimer Class.....................202

XNA Environment Initialization.................................................203

Saving Music to the Media Library......................................................205

Viewing High-Resolution Images with the MultiScaleImage Element.....207

Image Tiling..............................................................................208

Creating a Deep Zoom Image.....................................................208

Exploring the MultiScaleImage API.............................................210

Deep Zoom Viewer Sample Code................................................212

Displaying Web Content with the WebBrowser Element.........................217

Monitoring and Canceling Navigation........................................217

Communicating with a Web Page...............................................218

Injecting Web Page Behavior......................................................222

Storing and Browsing Content in Isolated Storage........................225

Summary.........................................................................228

Chapter 8 Taming the Application Bar 231

Exploring the Built-In Application Bar.................................................231

Using the ApplicationBar..........................................................232

Modifying the Application Bar’s Appearance................................234

Icon Button and Menu Item.......................................................234

Icon Button Image.....................................................................235

Retrieving a Button or Menu Item at Runtime..............................236

Introducing the Custom AppBar..........................................................237

AppBar Buttons and Menu Items.................................................237

Button and Menu Item Visibility.................................................238

Sample Code.............................................................................238

Switching to Full-Screen.............................................................244

Customizing the Appearance of the System Tray..........................247

Inside the AppBar Control..........................................................248

Summary...........................................................................252

Chapter 9 Enriching the User Experience with the Windows Phone Toolkit Controls 253

Getting Started with the Toolkit..........................................................254

In-Place Selection Using the ListPicker..............................................255

Display Modes...........................................................................255

Suggesting Text with the AutoCompleteBox.....................................259

Using AutoCompleteBox with MVVM...........................................260

Defining a Custom Filter Using the ItemFilter Property..............264

Dynamic Population of the Suggestion List..................................266

Styling the Suggestion List..........................................................268

Data Binding and the AutoCompleteBox.Text Property..................270

Displaying a ContextMenu...........................................................271

ContextMenu and MVVM............................................................273

Hosting a ContextMenu in a ListBoxItem.....................................275

Selecting Date and Time Values with the DatePicker and TimePicker....277

Using the DatePicker and TimePicker.........................................279

Adding a Control Header...........................................................281

Customizing the Value Format...................................................281

Customizing the Full-Screen Picker Page......................................282

Providing Custom Looping Lists with the LoopingSelector...................287

Providing Touch Feedback with the TiltEffect...................................291

Supporting Other Controls.........................................................292

Providing a Boolean Option with the ToggleSwitch..............................293

Using the ToggleSwitch.............................................................294

Localizing the ToggleSwitch.......................................................295

Changing the Switch Color........................................................297

Using Flexible Layouts with the WrapPanel...........................................297

Child Element Spacing...............................................................298

Sample Overview.......................................................................298

Using a WrapPanel in Conjunction with a ListBox.......................300

Summary...........................................................................302

Chapter 10 Creating Jump Lists with the Long List Selector 303

Visual Structure of the Long List Selector.............................................304

Presenting Flat Lists.....................................................................305

Presenting Grouped Lists....................................................................307

Marketplace App List Sample..............................................................307

Displaying a List of Contacts Using the LongListSelector....................316

Summary........................................................................................323

Chapter 11 Creating Expansive and Engaging Apps with the Pivot and Panorama 325

Pivot and Panorama Differences and Similarities...................................326

Style Assumptions.....................................................................326

Introduction to the Pivot Control..............................................327

Introduction to the Panorama Control.........................................327

Pivot and Panorama Placement in the FCL...........................................328

Performance Improvements in Windows Phone 8.................................329

Using the Pivot Control.....................................................................329

Placing a Pivot on a Page...........................................................329

Creating a Pivot Application with the Visual Studio New Project Dialog..................................331

Pivot Anatomy.........................................................................331

Setting the Active PivotItem......................................................332

Pivot Load Events.....................................................................333

Hosting Multiple Application Bars with the Pivot........................333

Populating a Pivot Via a Data Bound Collection..........................344

Using the Panorama Control........................................................347

Panorama Anatomy....................................................................347

PanoramaItem Control................................................................349

Sample Panorama Application......................................................350

Things to Avoid When Using the Panorama and Pivot..........................355

Windows Phone Toolkit Lockable Pivot...............................................355

Summary.......................................................................................355

Part III Windows Phone App Development

Chapter 12 Processing Touch Input 357

Handling Touch with Mouse Events....................................................358

Touch and TouchPoint Classes.............................................................360

Mouse Event Promotion.............................................................361

Handling the Touch.FrameReported Event...................................362

Manipulation Events..........................................................................363

Handling Manipulation Events...................................................364

Manipulation Events Example....................................................366

UIElement Touch Gesture Events.........................................................368

Tap Gesture..............................................................................369

Double Tap Gesture...................................................................370

Hold Gesture.............................................................................371

Windows Phone Toolkit Gestures........................................................372

Getting Started with Toolkit Gestures..........................................373

GestureListener Events in Detail...............................................373

GestureBegin and GestureCompleted Events................................380

Gesture Sample Code.................................................................381

Designing Touch-Friendly User Interfaces............................................386

Three Components of Touch......................................................386

Sizing and Spacing Constraints...................................................387

General Guidelines....................................................................387

Summary..................................................................................388

Chapter 13 Portraying Your App with Live Tiles 389

Getting Started with Live Tiles............................................................389

Tile Sizes and Resolutions...........................................................391

Introducing the Cycle Tile Template....................................................391

Introducing the Flip Tile Template......................................................394

Introducing the Iconic Tile Template...................................................395

Programmatically Updating Shell Tiles.................................................396

Controlling the Lock Screen’s Background and Notification Area...........397

Setting the Lock Screen’s Background Image................................399

Setting the Lock Screen’s Notification Text..................................401

Creating a Lock Screen Icon.......................................................403

Summary........................................................................404

Chapter 14 Leveraging Built-In Apps via Launchers and Choosers 405

API Overview....................................................................................405

Choosers and the Application Execution Model....................................407

Internal Workings of the ChooserBase.Completed Event...............407

Launchers and Choosers in Detail.......................................................408

Retrieve Driving Directions Using the BingMapsDirectionsTask.....409

Displaying a Location on a Map Using the BingMapsTask..............413

Navigating to a Connection Setting Page Using the ConnectionSettingsTask..........................................................413

Selecting an Email Address with the EmailAddressChooserTask.....414

Preparing an Email with the EmailComposeTask............................417

Saving a Contact’s Email Using the SaveEmailAddressTask...........418

Navigating to an App on the Marketplace with the MarketplaceDetailTask...........................................................422

Launching the Marketplace App with the MarketplaceHubTask......425

Allowing the User to Review Your App Using the MarketplaceReviewTask...........................................................426

Searching the Marketplace with the MarketplaceSearchTask.........427

Playing a Media File Using the MediaPlayerLauncher....................428

Placing a Call with the PhoneCallTask.........................................435

Selecting a Phone Number with the PhoneNumberChooserTask.......437

Saving a Contact’s Phone Number with the SavePhoneNumberTask...439

Searching the Web with the SearchTask......................................442

Sending Contacts a Link Using the ShareLinkTask.......................444

Posting a Status Update to Social Networks Using the ShareStatusTask.....................................................................445

Preparing an SMS With the SmsComposeTask................................445

Navigating to a Web Page Using the WebBrowserTask....................446

Selecting a Contact’s Address Using the AddressChooserTask........447

Saving a Contact to the Phone’s Contact List Using the SaveContactTask.....................................................................449

Taking a Photo with the CameraCaptureTask................................450

Inviting Game Players with the GameInviteTask...........................453

Selecting a Photo from the Photo Hub Using the PhotoChooserTask...................................................................454

Sharing Images with Other Devices Using NFC or with Other Registered Phone Services...............................................460

Creating a Ringtone with an Audio File Using the SaveRingtoneTask...................................................................461

Contacts and Appointments...............................................................464

Retrieving Contacts...................................................................464

Storing Contacts in the Custom Contact Store.............................469

Detecting Changes in Stored Contacts.........................................477

Converting a Stored Contact to and from a vCard........................478

Retrieving Appointments............................................................478

Saving an Appointment Using the SaveAppointmentTask......................483

Summary......................................................................484

Chapter 15 Receiving Messages from the Cloud Using Push Notification 485

Push Notifications Types....................................................................485

Benefits of Push Notification..............................................................486

Understanding Push Notification........................................................487

Getting Started with Push Notification................................................489

Subscribing to Push Notification.........................................................489

Binding to the Shell...................................................................490

HttpNotificationChannel Events................................................491

Handling Channel Errors...........................................................492

Power Management and Push Notification...........................................493

Sending Push Notifications.................................................................495

Toast Notifications.............................................................................495

Receiving a Toast Notification from Within an Application...........496

Sending a Toast Notification.......................................................497

Tile Notifications...............................................................................500

Sending a Tile Notification.........................................................501

Updating an Application Tile Using a Shell Tile Schedule..............504

Raw Notifications..............................................................................505

Sending a Raw Notification........................................................505

Receiving a Raw Notification......................................................508

Identifying Notifications in an HttpWebResponse..................................509

Notification Classes......................................................509

Cloud Service Authentication.............................................................511

Authenticating a Cloud Service...................................................511

Creating a Notification Channel for an Authenticated Cloud Service.....511

Building a Stock Ticker Application.....................................................511

Sample App Notifications...........................................................520

Summary.......................................................................524

Chapter 16 Sensing Motion and Attitude 525

Sensors Overview....................................................525

Measuring Force with the Accelerometer..............................................527

Using the Accelerometer Class...................................................528

Simulating Acceleration with the Emulator..................................529

Smoothing Accelerometer Readings.............................................530

Calibrating the Accelerometer.....................................................533

Shake Detection........................................................................537

Measuring Direction with the Compass...............................................539

Using the Compass Sensor..........................................................539

Compass Orientation.................................................................545

Calibrating the Compass............................................................546

Sensing Rotation with the Gyroscope..................................................548

Using the Gyroscope Sensor.......................................................549

Improving Sensor Accuracy with the Motion Sensor.............................552

Using the Motion Sensor............................................................553

Summary...........................................................................557

Chapter 17 Building Location Aware Apps 559

Location Sensing Technologies...........................................................559

A-GPS.......................................................................................560

Cell Tower Triangulation............................................................561

Wi-Fi Triangulation...................................................................562

Geographic Location Architecture.......................................................562

Getting Started with Location.............................................................563

Geolocator Class.......................................................................563

Background Location Tracking............................................................569

Testing Apps That Use the Geolocator.................................................570

Code-Driven Location Simulation.......................................................571

A Walkthrough of the Location Viewer Sample....................................575

GeoLocationViewModel Class.......................................................575

Displaying Location Using the GeoLocationView Page...................577

Civic Address Resolution............................................................580

Sampling the PositionChanged Event with Rx......................................580

Getting Started with Rx for Windows Phone................................580

Summary..............................................................................584

Chapter 18 Incorporating Map-Based Positioning 585

Getting Started with the Map Control.................................................586

Obtaining an ApplicationId and AuthenticationToken................587

Overview of the Sample Map View......................................................587

Adjusting for Low Light Conditions....................................................588

Changing Cartographic Modes............................................................589

Panning and Zooming the Map Control..............................................590

Centering the Map to the Phone’s Current Location.....................590

Setting the Viewable Area of the Map..........................................592

Adjusting Pitch and Heading..............................................................593

Location Tracking..............................................................................594

Overlaying Custom Map Content........................................................596

Calculating and Displaying a Route.....................................................598

Calculating the Shortest Route Between Two Points......................598

Using the Route Calculator.........................................................601

Searching for a Route Using the View..........................................602

Modifying Page Elements Using Visual States.......................................604

Displaying the Route and Itinerary..............................................609

Showing a Location with the Built-In Maps App...................................610

Showing Directions with the Built-In Maps App...................................611

Downloading Maps for Offline Use.....................................................612

Summary...............................................................................612

Chapter 19 Supporting Multiple Cultures and Languages 613

Terminology...................................................................613

Localizability Using Resx Files.............................................................614

Getting Started with Resx Files....................................................615

Working with Resx Files.............................................................615

Dynamic Localizability–Updating the UI When the Culture Changes....618

Localizing Images Using Resx Files......................................................620

The Resx Localizability Sample............................................................621

Controlling the UI Culture from the LocalizabilityViewModel.....622

Displaying Localized Text and Images Within the LocalizabilityView Page..........625

RTL Support..............................................................................629

Summary...................................................................630

Chapter 20 Extending the Windows Phone Picture Viewer 631

Creating a Photos Extras Application...................................................632

Adding Your App to the Extras Menu..........................................634

An Edge-Tracing Extras Application.............................................634

Saving the Image.......................................................................643

Share Menu Extensibility....................................................................645

Adding Your App to the Share Menu...........................................646

A Simple Photo Upload Share Application...................................647

Summary.......................................................................654

Chapter 21 Capturing Images and Video with the Camera 655

PhotoCamera...................................................................656

Building a PhotoCamera App.......................................................658

Using the Silverlight Webcam API.......................................................678

CaptureSourceViewModel............................................................680

Displaying Video in the CaptureSourceView.................................684

Extending the Camera Experience with a Lens.....................................686

Registering as a Lens..................................................................687

Creating Lens Icons...................................................................689

Summary............................................................................689

Chapter 22 Recording Audio with the Microphone 691

Recording Audio with the Microphone................................................691

Creating a Helium Voice App.....................................................692

Summary...................................................................698

Chapter 23 Creating Speech Driven Experiences 699

User Input with Speech Recognition....................................................700

Getting Started with Speech Recognition.....................................700

Overview of Recognition Grammars............................................701

Recognizing Speech Using the Dictation and Web Search Grammars....702

Recognizing Speech with Phrase List Grammars...........................703

Recognizing Speech with SRGS Grammars...................................710

Speech Recognizer Settings.........................................................717

Providing a Custom Speech Recognition UI.................................718

Recognizing Speech in Other Languages......................................721

Launching Your App via Voice Commands..........................................723

Understanding the Structure of the VCD File...............................724

Installing a VCD........................................................................726

Updating a Phrase List Programmatically.....................................731

Making the Phone Speak with Text-to-Speech......................................732

Getting Started with TTS............................................................732

Creating a Speech Synthesis Markup Language File.......................733

Summary......................................................................735

Chapter 24 Unit Testing Apps 737

Automated Testing........................................................738

Unit Testing..............................................................................738

Integration Testing....................................................................739

Coded UI Testing.......................................................................739

Introduction to the Windows Phone Unit Test Framework....................739

Creating a Test Project.......................................................................740

Creating a Test Class.......................................741

Tag Expressions.........................................................743

Setting the Tag Expression Programmatically...............................744

Metadata and Assertions..................................................744

TestClass Attribute...................................................................744

TestMethod Attribute.................................................................745

Metadata for Test Initialization and Cleanup................................745

Miscellaneous Metadata.............................................................747

WorkItemTest: The Base TestClass Type......................................751

Verifying Conditions with Assertions..........................................751

Verifying Collection Conditions with CollectionAssert...............752

Verifying String Conditions with StringAssert............................752

Hiding the Expressions Editor.....................................................752

Testing Multiple Assemblies........................................................753

Testing Nonpublic Members.......................................................753

A Testable Chat Client.......................................................................754

Building the View......................................................................758

Code Driven UI Testing..............................................................760

Using Automation Peers to Manipulate UI Elements at Runtime....763

Inversion of Control (IoC)..................................................................765

A Custom IoC Container and DI Framework................................766

Testing Trial Conditions.....................................................................767

Abstracting the LicenseInformation Class...................................767

Testing with Launchers and Choosers..................................................769

Summary............................................................................771

Chapter 25 Manage Payment Instruments Using Wallet Extensibility 773

Introducing the Wallet Hub................................................................774

Required Capabilities for Wallet Integration.........................................775

Storing Payment Instruments in the Wallet..........................................775

Overview of the Payment Instruments Sample App......................777

Keeping Payment Instruments Up-To-Date with a Background Agent...................................................................789

Storing Membership Information in the Wallet....................................792

Storing Deals in the Wallet.................................................................796

Keeping Deals and Membership Information Up-to-Date with a Background Agent.........................................................802

Summary......................................................................804

Part IV Building Data Driven Apps

Chapter 26 Validating User Input 805

Defining Input Validation..................................................................805

Syntactic Validation...................................................................806

Semantic Validation...................................................................806

Input Validation Using Property Setters...............................................806

Validation Class........................................................................809

Critical Exceptions.....................................................................809

Binding Errors...........................................................................809

Defining Validation Visual States in Windows Phone............................810

Validating a TextBox as the User Types........................................815

Performing Group Validation.....................................................818

Displaying Error Details.............................................................820

Property Setter Validation Limitations.........................................823

Asynchronous and Composite Validation............................................824

A Reusable Implementation of the NotifyDataErrorInfo Interface.................................................................................825

Provisioning for Asynchronous or Synchronous Validation...........827

Asynchronous Validation of All Properties...................................833

An Example of Asynchronous Input Validation............................836

Detecting a Change of Data Context...........................................840

Adding INotifyDataErrorInfo Support to the ValidationSummary Control......................................................842

Incorporating Group Validation..................................................844

Summary........................................................................847

Chapter 27 Communicating with Network Services 849

Network Service Technologies.............................................................850

Monitoring Network Connectivity......................................................850

Connection Priorities.................................................................850

Introduction to OData.......................................................................855

Consuming OData.............................................................................855

OData URI Structure..................................................................856

Generating an OData Proxy........................................................858

OData Query Options................................................................858

Using an OData Proxy........................................................................860

Building an eBay OData Consumer Application....................................862

Creating an OData Wrapper.......................................................862

EbaySearchViewModel Class........................................................864

EbaySearchView Page.................................................................867

Fetching Data When the User Scrolls to the End of a List......................871

Extending OData Entity Classes..................................................874

Simulating Real-World Conditions with the Simulation Dashboard........876

Moderating Data Usage with Data Sense..............................................877

Using the Data Sense API...........................................................877

Summary..............................................................................879

Chapter 28 Preserving App State and Settings 881

Understanding Managed Storage.........................................................882

Working with Files and Directories......................................................883

Introducing the .NET Isolated Storage API....................................884

Introducing the WinPRT Windows Storage API............................887

Measuring the Amount of Available Free Space............................888

Application Settings...................................................................888

Abstracting IsolatedStorageSettings.................................................889

Building an Automatic State Preservation System..................................890

Customizing ViewModel State Preservation..................................892

Automatic State Preservation Inner Workings...............................893

Unwinding a Property Lambda Expression...................................901

Creating Property Accessor Delegates...........................................902

Summary........................................................................903

Chapter 29 Storing App Data in a Local Database 905

SQL Server Compact.........................................................906

Deployment of Local Databases...........................................................906

LINQ to SQL on the Phone.................................................................908

LINQ to SQL Platform Differences.......................................................909

Getting Started with Local Databases...................................................909

Code-First Data Model Creation..................................................909

Sample Twitter Timeline Viewer..........................................................910

Using the Column Attribute.........................................................912

Data Context Change Tracking...................................................915

TwitterUser Class.....................................................................915

Multiplicity and the Association Attribute..................................917

Twitter DataContext..................................................................918

Database Utilities.......................................................................919

Connection Strings....................................................................920

Leveraging a Custom Twitter Service...........................................924

Gathering the User’s Credentials with the Sign-In View................929

Viewing Tweets with the Timeline View......................................932

Viewing a Local Database Schema.......................................................937

File Explorers for Isolated Storage................................................938

Viewing and Modifying an SQL CE Database File.........................940

Database-First Using SqlMetal.............................................................942

Deploying a Database to Isolated Storage..........................................943

Abstracting the Navigation Service......................................................946

Observing LINQ to SQL Queries with a Custom Log.............................948

Updating a Database Schema................................................951

AddColumn.................................................................................952

AddTable...................................................................................952

AddIndex...................................................................................954

AddAssociation.........................................................................955

Schema Versioning....................................................................957

Mapping an Inheritance Hierarchy......................................................958

Concurrency.....................................................................................962

ColumnAttribute.UpdateCheck...................................................965

Summary............................................................................966

Chapter 30 Auto-Launching with File and Protocol Associations 967

Understanding File and Protocol Associations......................................968

A Note About the Sample...................................................................968

Auto-Launching with a File Extension Association................................968

Registering a File Association......................................................968

Receiving a File Launch Request..................................................970

Launching a File........................................................................973

How File and Protocol Associations Affect the User Experience..............976

Auto-Launching with a Protocol Association........................................977

Registering for a Protocol Association..........................................977

Receiving a Protocol Launch Request...........................................977

Launching a Protocol URI..........................................................979

Reserved Protocol Names............................................................981

Launching Built-In Apps.....................................................................981

Summary..............................................................................982

Chapter 31 Extending the Search Experience 983

Understanding Quick Cards................................................................983

Configuring Your App for Search Integration.......................................985

Configuring the Application Manifest.........................................985

Customizing Captions via the Extras.xml File..............................987

Defining a Quick Card Target Page..............................................989

Creating a Landing Page to Display Quick Card Information.................994

App Instant Answer...........................................................................996

Summary....................................................................................996

Part V Multitasking

Chapter 32 Conducting Background Activities with Scheduled Actions 997

Background Tasks................................................................998

Scheduled Notifications......................................................................998

Alarm Registration...................................................................1001

Alarm Sample..........................................................................1002

Reminder Registration..............................................................1005

Reminder Sample....................................................................1006

Scheduled Tasks.....................................................................1010

Background Agent Types..........................................................1011

Using Scheduled Tasks.............................................................1015

To-Do List Scheduled Task Sample............................................1019

Updating Tiles Using a Scheduled Task Agent............................1035

Scheduled Task API Limitations................................................1036

Using a Mutex to Access Common Resources Safely.............................1038

Summary..........................................................................1041

Chapter 33 Performing Background File Transfers 1043

Background Transfer Requests............................................1043

Handling App Termination and Resubscription to Transfer Events......1048

Background File Transfer Sample Code..............................................1048

Using URL Rerouting with a WCF Service..................................1049

Retrieving the User’s Windows Live Anonymous ID...................1050

TodoListViewModel..................................................................1052

Backing Up the Local Database.................................................1052

Restoring the Local Database....................................................1055

Summary......................................................................1058

Chapter 34 Coordinating Background Audio Playback 1059

Background Agent Recap..................................................................1059

Background Audio Overview.............................................................1060

Background Audio Player..................................................................1060

Representing Audio Files with the AudioTrack Class............................1062

Creating a Custom Audio Player Agent..............................................1063

AudioPlayerAgent Sample................................................................1064

AudioPlayerAgent Virtual Methods...........................................1066

Controlling Background Audio from Your Foreground App.........1070

Audio Streaming Agents...................................................................1076

Using a MediaStreamSource to Play Back an Assembly Resource...1078

Summary........................................................................1079

Bibliography 1081

9780672336898 TOC 4/18/2013

Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)