Home Page Icon
Home Page
Table of Contents for
TestClass Attribute
Close
TestClass Attribute
by Daniel Vaughan
Windows® Phone 8 Unleashed
About This eBook
Title Page
Copyright Page
Contents at a Glance
Table of Contents
Preface
Scope of This Book
Assumptions About the Reader
Book Structure
Code Samples
About the Author
Dedication
Acknowledgments
We Want to Hear from You!
Reader Services
Part I: Windows Phone App Development Fundamentals
Chapter 1. Introduction to Windows Phone App Development
Installing the Windows Phone SDK
Creating Your First XAML for Windows Phone App
The Application Class
Summary
Chapter 2. Fundamental Concepts in Windows Phone Development
Understanding the Role of XAP Files
The Application Deployment Tool
The Windows Phone Capabilities Model
Determining App Capabilities Using the Marketplace Test Kit
The Threading Model for XAML-Based Graphics and Animation in Windows Phone
Performance and Element Visibility
Deciding Between Visibility and Opacity
Understanding the Frame Rate Counter
The Windows Phone Application Analysis Tool
External Events
Frame Rate Graph
CPU Usage Graph
Memory Usage MB Graph
Storyboards
Image Loads
GC Events
Viewing Detailed Profiling Information
Reading Device Information
Calculating Available Memory
DeviceStatus Events
Applying the Model-View-ViewModel Pattern to a Windows Phone App
Implementing the MVVM Pattern
ViewModelBase Class
Property Change Notification
Implementing INotifyPropertyChanged: The Traditional Approach
Implementing INotifyPropertyChanged: An Alternative Approach
Using Commands
Argument Validation
A Platform-Agnostic Dialog Service
Consuming Local Web Applications
Summary
Chapter 3. Understanding the Application Execution Model
Exploring the Execution Model
Application State
Life Cycle Events
Programmatically Exiting an App
Saving Transient State
Restoring Transient State
Saving Persistent State
Implementing Fast App Resume
Enabling Fast App Resume
Optimizing the Resume Experience
Running Under the Lock Screen
Lock Screen Management
Page Navigation
Navigation Using Unmapped URIs
Passing Page Arguments Using Query Strings
URI Mapping
Navigation Using the NavigationService
Handling Page Navigation
Canceling Navigation
Cross-Page Communication
Page Redirection
Hardware Back Button
Creating an Application Splash Screen
Walking Through the Bookshop Sample Application
Displaying the Product List
Design-Time Data
Image Caching
Overview of the Sample Bookshop WCF Service
Summary
Chapter 4. Controlling Page Orientation
Orientation and the PhoneApplicationPage Class
OrientationChanged Event
PhoneApplicationPage Orientation Property
Setting Page Orientation at Runtime
Animating Page Elements When the Page Orientation Changes
Animating the Entire Page When Orientation Changes
Windows Phone Toolkit Animated Page Transitions
Using Windows Phone Toolkit Transitions
Reusing the Transition Attached Properties
Summary
Part II: Essential Elements
Chapter 5. Using Content Controls, Items Controls, and Range Controls
Control Type Taxonomy
Identifying Controls Not Supported or Absent in Windows Phone
Content Controls
Defining the Default Content Property
Receiving Input with Buttons
Tap and Click Events
Button Click Mode
Hyperlink Button
Repeat and Toggle Buttons
Radio Button
Check Box
ToolTip
Items Controls
ListBox
ComboBox
Range Controls
ProgressBar
Progress Indicator
Slider
ScrollBar
Summary
Chapter 6. Mastering Text Elements and Fonts
Understanding Text Element Types
Displaying Text Using the TextBlock
Using the Run and LineBreak Objects
Multiline TextBlock Text
Controlling Font Properties
Understanding the Built-In Fonts
Using Third-Party Fonts via Font Embedding
Leveraging FontSource to Assign a Font Using a Stream
Receiving Input Using a TextBox
Software Input Panel
Input Scope
Input Scope Sample Overview
Receiving Password Text Using a PasswordBox
Displaying Rich Content Using a RichTextBox
Formatting Text at Runtime
Further Reading
Placing Text on the Clipboard
Summary
Chapter 7. Employing Media and Web Elements
Displaying Images with the Image Element
Image Sizing
Providing a Drawing Surface with the InkPresenter Element
Capturing User Input
InkPresenter Sample Code
Playing Audio and Video with the MediaElement
MediaElement Sample Code
XNA SoundEffect Class
Harnessing the XNA Game Loop Via the GameTimer Class
XNA Environment Initialization
Saving Music to the Media Library
Viewing High-Resolution Images with the MultiScaleImage Element
Image Tiling
Creating a Deep Zoom Image
Exploring the MultiScaleImage API
Deep Zoom Viewer Sample Code
Displaying Web Content with the WebBrowser Element
Monitoring and Canceling Navigation
Communicating with a Web Page
Injecting Web Page Behavior
Storing and Browsing Content in Isolated Storage
Summary
Chapter 8. Taming the Application Bar
Exploring the Built-In Application Bar
Using the ApplicationBar
Modifying the Application Bar’s Appearance
Icon Button and Menu Item
Icon Button Image
Retrieving a Button or Menu Item at Runtime
Introducing the Custom AppBar
Button and Menu Item Visibility
Sample Code
Switching to Full-Screen
Customizing the Appearance of the System Tray
Inside the AppBar Control
Summary
Chapter 9. Enriching the User Experience with the Windows Phone Toolkit Controls
Getting Started with the Toolkit
In-Place Selection Using the ListPicker
Display Modes
Suggesting Text with the AutoCompleteBox
Using AutoCompleteBox with MVVM
Defining a Custom Filter Using the ItemFilter Property
Dynamic Population of the Suggestion List
Styling the Suggestion List
Data Binding and the AutoCompleteBox.Text Property
Displaying a ContextMenu
ContextMenu and MVVM
Hosting a ContextMenu in a ListBoxItem
Selecting Date and Time Values with the DatePicker and TimePicker
Using the DatePicker and TimePicker
Adding a Control Header
Customizing the Value Format
Customizing the Full-Screen Picker Page
Providing Custom Looping Lists with the LoopingSelector
Providing Touch Feedback with the TiltEffect
Supporting Other Controls
Providing a Boolean Option with the ToggleSwitch
Using the ToggleSwitch
Localizing the ToggleSwitch
Changing the Switch Color
Using Flexible Layouts with the WrapPanel
Child Element Spacing
Sample Overview
Using a WrapPanel in Conjunction with a ListBox
Summary
Chapter 10. Creating Jump Lists with the Long List Selector
Visual Structure of the Long List Selector
Presenting Flat Lists
Presenting Grouped Lists
Marketplace App List Sample
Displaying a List of Contacts Using the LongListSelector
Summary
Chapter 11. Creating Expansive and Engaging Apps with the Pivot and Panorama
Pivot and Panorama Differences and Similarities
Style Assumptions
Introduction to the Pivot Control
Introduction to the Panorama Control
Pivot and Panorama Placement in the FCL
Performance Improvements in Windows Phone 8
Using the Pivot Control
Placing a Pivot on a Page
Creating a Pivot Application with the Visual Studio New Project Dialog
Pivot Anatomy
Setting the Active PivotItem
Pivot Load Events
Hosting Multiple Application Bars with the Pivot
Populating a Pivot Via a Data Bound Collection
Using the Panorama Control
Panorama Anatomy
PanoramaItem Control
Sample Panorama Application
Things to Avoid When Using the Panorama and Pivot
Windows Phone Toolkit Lockable Pivot
Summary
Part III: Windows Phone App Development
Chapter 12. Processing Touch Input
Handling Touch with Mouse Events
Touch and TouchPoint Classes
Mouse Event Promotion
Handling the Touch.FrameReported Event
Manipulation Events
Handling Manipulation Events
Manipulation Events Example
UIElement Touch Gesture Events
Tap Gesture
Double Tap Gesture
Hold Gesture
Windows Phone Toolkit Gestures
Getting Started with Toolkit Gestures
GestureListener Events in Detail
GestureBegin and GestureCompleted Events
Gesture Sample Code
Designing Touch-Friendly User Interfaces
Three Components of Touch
Sizing and Spacing Constraints
General Guidelines
Summary
Chapter 13. Portraying Your App with Live Tiles
Getting Started with Live Tiles
Tile Sizes and Resolutions
Introducing the Cycle Tile Template
Introducing the Flip Tile Template
Introducing the Iconic Tile Template
Programmatically Updating Shell Tiles
Controlling the Lock Screen’s Background and Notification Area
Setting the Lock Screen’s Background Image
Setting the Lock Screen’s Notification Text
Creating a Lock Screen Icon
Summary
Chapter 14. Leveraging Built-In Apps via Launchers and Choosers
API Overview
Choosers and the Application Execution Model
Internal Workings of the ChooserBase.Completed Event
Launchers and Choosers in Detail
Retrieve Driving Directions Using the BingMapsDirectionsTask
Displaying a Location on a Map Using the BingMapsTask
Navigating to a Connection Setting Page Using the ConnectionSettingsTask
Selecting an Email Address with the EmailAddressChooserTask
Preparing an Email with the EmailComposeTask
Saving a Contact’s Email Using the SaveEmailAddressTask
Navigating to an App on the Marketplace with the MarketplaceDetailTask
Launching the Marketplace App with the MarketplaceHubTask
Allowing the User to Review Your App Using the MarketplaceReviewTask
Searching the Marketplace with the MarketplaceSearchTask
Playing a Media File Using the MediaPlayerLauncher
Placing a Call with the PhoneCallTask
Selecting a Phone Number with the PhoneNumberChooserTask
Saving a Contact’s Phone Number with the SavePhoneNumberTask
Searching the Web with the SearchTask
Sending Contacts a Link Using the ShareLinkTask
Posting a Status Update to Social Networks Using the ShareStatusTask
Preparing an SMS With the SmsComposeTask
Navigating to a Web Page Using the WebBrowserTask
Selecting a Contact’s Address Using the AddressChooserTask
Saving a Contact to the Phone’s Contact List Using the SaveContactTask
Taking a Photo with the CameraCaptureTask
Inviting Game Players with the GameInviteTask
Selecting a Photo from the Photo Hub Using the PhotoChooserTask
Sharing Images with Other Devices Using NFC or with Other Registered Phone Services
Creating a Ringtone with an Audio File Using the SaveRingtoneTask
Contacts and Appointments
Retrieving Contacts
Storing Contacts in the Custom Contact Store
Detecting Changes in Stored Contacts
Converting a Stored Contact to and from a vCard
Retrieving Appointments
Saving an Appointment Using the SaveAppointmentTask
Summary
Chapter 15. Receiving Messages from the Cloud Using Push Notification
Push Notifications Types
Benefits of Push Notification
Understanding Push Notification
Getting Started with Push Notification
Subscribing to Push Notification
Binding to the Shell
HttpNotificationChannel Events
Handling Channel Errors
Power Management and Push Notification
Sending Push Notifications
Toast Notifications
Receiving a Toast Notification from Within an Application
Sending a Toast Notification
Tile Notifications
Sending a Tile Notification
Updating an Application Tile Using a Shell Tile Schedule
Raw Notifications
Sending a Raw Notification
Receiving a Raw Notification
Identifying Notifications in an HttpWebResponse
Notification Classes
Cloud Service Authentication
Authenticating a Cloud Service
Creating a Notification Channel for an Authenticated Cloud Service
Building a Stock Ticker Application
Sample App Notifications
Summary
Chapter 16. Sensing Motion and Attitude
Sensors Overview
Measuring Force with the Accelerometer
Using the Accelerometer Class
Simulating Acceleration with the Emulator
Smoothing Accelerometer Readings
Calibrating the Accelerometer
Shake Detection
Measuring Direction with the Compass
Using the Compass Sensor
Compass Orientation
Calibrating the Compass
Sensing Rotation with the Gyroscope
Using the Gyroscope Sensor
Improving Sensor Accuracy with the Motion Sensor
Using the Motion Sensor
Summary
Chapter 17. Building Location Aware Apps
Location Sensing Technologies
A-GPS
Cell Tower Triangulation
Wi-Fi Triangulation
Geographic Location Architecture
Getting Started with Location
Geolocator Class
Background Location Tracking
Testing Apps That Use the Geolocator
Code-Driven Location Simulation
A Walkthrough of the Location Viewer Sample
GeoLocationViewModel Class
Displaying Location Using the GeoLocationView Page
Civic Address Resolution
Sampling the PositionChanged Event with Rx
Getting Started with Rx for Windows Phone
Summary
Chapter 18. Incorporating Map-Based Positioning
Getting Started with the Map Control
Obtaining an ApplicationId and AuthenticationToken
Overview of the Sample Map View
Adjusting for Low Light Conditions
Changing Cartographic Modes
Panning and Zooming the Map Control
Centering the Map to the Phone’s Current Location
Setting the Viewable Area of the Map
Adjusting Pitch and Heading
Location Tracking
Overlaying Custom Map Content
Calculating and Displaying a Route
Calculating the Shortest Route Between Two Points
Using the Route Calculator
Searching for a Route Using the View
Modifying Page Elements Using Visual States
Displaying the Route and Itinerary
Showing a Location with the Built-In Maps App
Showing Directions with the Built-In Maps App
Downloading Maps for Offline Use
Summary
Chapter 19. Supporting Multiple Cultures and Languages
Terminology
Localizability Using Resx Files
Getting Started with Resx Files
Working with Resx Files
Dynamic Localizability—Updating the UI When the Culture Changes
Localizing Images Using Resx Files
The Resx Localizability Sample
Controlling the UI Culture from the LocalizabilityViewModel
Displaying Localized Text and Images Within the LocalizabilityView Page
RTL Support
Summary
Chapter 20. Extending the Windows Phone Picture Viewer
Creating a Photos Extras Application
Adding Your App to the Extras Menu
An Edge-Tracing Extras Application
Saving the Image
Share Menu Extensibility
Adding Your App to the Share Menu
A Simple Photo Upload Share Application
Summary
Chapter 21. Capturing Images and Video with the Camera
PhotoCamera
Building a PhotoCamera App
Using the Silverlight Webcam API
CaptureSourceViewModel
Displaying Video in the CaptureSourceView
Extending the Camera Experience with a Lens
Registering as a Lens
Creating Lens Icons
Summary
Chapter 22. Recording Audio with the Microphone
Recording Audio with the Microphone
Creating a Helium Voice App
Summary
Chapter 23. Creating Speech Driven Experiences
User Input with Speech Recognition
Getting Started with Speech Recognition
Overview of Recognition Grammars
Recognizing Speech Using the Dictation and Web Search Grammars
Recognizing Speech with Phrase List Grammars
Recognizing Speech with SRGS Grammars
Speech Recognizer Settings
Providing a Custom Speech Recognition UI
Recognizing Speech in Other Languages
Launching Your App via Voice Commands
Understanding the Structure of the VCD File
Installing a VCD
Updating a Phrase List Programmatically
Making the Phone Speak with Text-to-Speech
Getting Started with TTS
Creating a Speech Synthesis Markup Language File
Summary
Chapter 24. Unit Testing Apps
Automated Testing
Unit Testing
Integration Testing
Coded UI Testing
Introduction to the Windows Phone Unit Test Framework
Creating a Test Project
Creating a Test Class
Tag Expressions
Setting the Tag Expression Programmatically
Metadata and Assertions
TestClass Attribute
TestMethod Attribute
Metadata for Test Initialization and Cleanup
Miscellaneous Metadata
WorkItemTest: The Base TestClass Type
Verifying Conditions with Assertions
Verifying Collection Conditions with CollectionAssert
Verifying String Conditions with StringAssert
Hiding the Expressions Editor
Testing Multiple Assemblies
Testing Nonpublic Members
A Testable Chat Client
Building the View
Code Driven UI Testing
Using Automation Peers to Manipulate UI Elements at Runtime
Inversion of Control (IoC)
A Custom IoC Container and DI Framework
Testing Trial Conditions
Abstracting the LicenseInformation Class
Testing with Launchers and Choosers
Summary
Chapter 25. Manage Payment Instruments Using Wallet Extensibility
Introducing the Wallet Hub
Required Capabilities for Wallet Integration
Storing Payment Instruments in the Wallet
Overview of the Payment Instruments Sample App
Keeping Payment Instruments Up-To-Date with a Background Agent
Storing Membership Information in the Wallet
Storing Deals in the Wallet
Keeping Deals and Membership Information Up-to-Date with a Background Agent
Summary
Part IV: Building Data Driven Apps
Chapter 26. Validating User Input
Defining Input Validation
Syntactic Validation
Semantic Validation
Input Validation Using Property Setters
Validation Class
Critical Exceptions
Binding Errors
Defining Validation Visual States in Windows Phone
Validating a TextBox as the User Types
Performing Group Validation
Displaying Error Details
Property Setter Validation Limitations
Asynchronous and Composite Validation
A Reusable Implementation of the NotifyDataErrorInfo Interface
Provisioning for Asynchronous or Synchronous Validation
Asynchronous Validation of All Properties
An Example of Asynchronous Input Validation
Detecting a Change of Data Context
Adding INotifyDataErrorInfo Support to the ValidationSummary Control
Incorporating Group Validation
Summary
Chapter 27. Communicating with Network Services
Network Service Technologies
Monitoring Network Connectivity
Connection Priorities
Introduction to OData
Consuming OData
OData URI Structure
Generating an OData Proxy
OData Query Options
Using an OData Proxy
Building an eBay OData Consumer Application
Creating an OData Wrapper
EbaySearchViewModel Class
EbaySearchView Page
Fetching Data When the User Scrolls to the End of a List
Extending OData Entity Classes
Simulating Real-World Conditions with the Simulation Dashboard
Moderating Data Usage with Data Sense
Using the Data Sense API
Summary
Chapter 28. Preserving App State and Settings
Understanding Managed Storage
Working with Files and Directories
Introducing the .NET Isolated Storage API
Introducing the WinPRT Windows Storage API
Measuring the Amount of Available Free Space
Application Settings
Abstracting IsolatedStorageSettings
Building an Automatic State Preservation System
Customizing ViewModel State Preservation
Automatic State Preservation Inner Workings
Unwinding a Property Lambda Expression
Creating Property Accessor Delegates
Summary
Chapter 29. Storing App Data in a Local Database
SQL Server Compact
Deployment of Local Databases
LINQ to SQL on the Phone
LINQ to SQL Platform Differences
Getting Started with Local Databases
Code-First Data Model Creation
Sample Twitter Timeline Viewer
Using the Column Attribute
Data Context Change Tracking
TwitterUser Class
Multiplicity and the Association Attribute
Twitter DataContext
Database Utilities
Connection Strings
Leveraging a Custom Twitter Service
Gathering the User’s Credentials with the Sign-In View
Viewing Tweets with the Timeline View
Viewing a Local Database Schema
File Explorers for Isolated Storage
Viewing and Modifying an SQL CE Database File
Database-First Using SqlMetal
Deploying a Database to Isolated Storage
Abstracting the Navigation Service
Observing LINQ to SQL Queries with a Custom Log
Updating a Database Schema
AddColumn
AddTable
AddIndex
AddAssociation
Schema Versioning
Mapping an Inheritance Hierarchy
Concurrency
ColumnAttribute.UpdateCheck
Summary
Chapter 30. Auto-Launching with File and Protocol Associations
Understanding File and Protocol Associations
A Note About the Sample
Auto-Launching with a File Extension Association
Registering a File Association
Receiving a File Launch Request
Launching a File
How File and Protocol Associations Affect the User Experience
Auto-Launching with a Protocol Association
Registering for a Protocol Association
Receiving a Protocol Launch Request
Launching a Protocol URI
Reserved Protocol Names
Launching Built-In Apps
Summary
Chapter 31. Extending the Search Experience
Understanding Quick Cards
Configuring Your App for Search Integration
Configuring the Application Manifest
Customizing Captions via the Extras.xml File
Defining a Quick Card Target Page
Creating a Landing Page to Display Quick Card Information
App Instant Answer
Summary
Part V: Multitasking
Chapter 32. Conducting Background Activities with Scheduled Actions
Background Tasks
Scheduled Notifications
Alarm Registration
Alarm Sample
Reminder Registration
Reminder Sample
Scheduled Tasks
Background Agent Types
Using Scheduled Tasks
To-Do List Scheduled Task Sample
Updating Tiles Using a Scheduled Task Agent
Scheduled Task API Limitations
Using a Mutex to Access Common Resources Safely
Summary
Chapter 33. Performing Background File Transfers
Background Transfer Requests
Handling App Termination and Resubscription to Transfer Events
Background File Transfer Sample Code
Using URL Rerouting with a WCF Service
Retrieving the User’s Windows Live Anonymous ID
TodoListViewModel
Backing Up the Local Database
Restoring the Local Database
Summary
Chapter 34. Coordinating Background Audio Playback
Background Agent Recap
Background Audio Overview
Background Audio Player
Representing Audio Files with the AudioTrack Class
Creating a Custom Audio Player Agent
AudioPlayerAgent Sample
AudioPlayerAgent Virtual Methods
Controlling Background Audio from Your Foreground App
Audio Streaming Agents
Using a MediaStreamSource to Play Back an Assembly Resource
Summary
Bibliography
Index
Search in book...
Toggle Font Controls
Playlists
Add To
Create new playlist
Name your new playlist
Playlist description (optional)
Cancel
Create playlist
Sign In
Email address
Password
Forgot Password?
Create account
Login
or
Continue with Facebook
Continue with Google
Sign Up
Full Name
Email address
Confirm Email Address
Password
Login
Create account
or
Continue with Facebook
Continue with Google
Prev
Previous Chapter
Metadata and Assertions
Next
Next Chapter
TestMethod Attribute
TestClass
Attribute
,
The
TestClass
attribute indicates that a class contains test methods.
Add Highlight
No Comment
..................Content has been hidden....................
You can't read the all page of ebook, please click
here
login for view all page.
Day Mode
Cloud Mode
Night Mode
Reset