Chapter 2. Fundamental Concepts in Windows Phone Development

,

In This Chapter

Image Understanding the role of XAP files

Image Using the Application Deployment tool

Image Enabling and identifying app capabilities using the Marketplace Test Kit

Image The threading model for XAML graphics and animation

Image Optimizing animation performance

Image Enabling and reading the Frame Rate Counter

Image Using memory and execution profiling to identify bottlenecks

Image Retrieving device information using the DeviceStatus class

Image Applying MVVM to a Windows Phone app

Image Simplifying property change notification

Image Using commanding with MVVM

Image Validating method arguments

Image Building a platform agnostic dialog service

Image Enabling communication with local WCF services


This chapter provides an overview of some common pieces of phone infrastructure and describes various techniques that are useful when building Windows Phone apps.

This chapter begins with a look at the principal output of a Windows Phone Application project: the XAP file. The chapter discusses its composition and shows how to deploy a XAP file to a developer unlocked device.

The chapter then looks at the security capability model of the phone and at how this model is used to notify the user of any potential dangers before downloading an app from the Windows Phone Marketplace. You also look at using the Marketplace Test Kit to determine the capability requirements of your app.

Next, the chapter examines the threading model of XAML for Windows Phone and examines various performance considerations when creating animations or hiding and showing visual elements. You see how the Windows Phone frame rate counter works and learn how to interpret each reading shown on the display.

The chapter then looks at the Windows Phone Application Analysis tool. You see how to profile your app’s performance and memory usage, improve the responsiveness of your app, and help ensure that your app passes the Windows Phone Marketplace certification requirements.

The chapter turns to the custom code and commonly used techniques that you see throughout the book and that underpin many of the examples in subsequent chapters.

It is not uncommon to have many pages in a Windows Phone app, and having a solid codebase that contains a common infrastructure and frequently used services can save a lot of time. In fact, with more than 100 example pages included in the downloadable sample code, creating the code for this book would have taken considerably longer without it.

The techniques demonstrated are tried and tested approaches that help you build more maintainable apps and, by the end of the book, will have become exceedingly familiar to you if they are not so already.

The overview of the custom infrastructure begins with an exposé of the Model-View-ViewModel pattern, and you see how it is applied in the downloadable sample code. You then examine how property change notification is implemented and see techniques for improving the traditional implementation of INotifyPropertyChanged so that it works effortlessly with multithreaded apps.

Next, the chapter looks at the commanding infrastructure used throughout the book and examines a custom ICommand that allows you to specify handlers for command evaluation and execution. There is also a brief overview of the argument validation system commonly used in the sample code to validate method arguments.

The chapter then explores a custom dialog service that enables you to ask the user a question from your viewmodel, while remaining compatible with unit testing.

Finally, the chapter shows how to consume Windows Communication Foundation (WCF) services that reside on the same machine as the emulator, and outlines important steps to enable several of the apps in the downloadable sample code.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.158.106