The book is broken up into 5 chapters. The first chapter deals with the basics of XAML (the markup language used to design user interfaces in Windows Phone. If you have done programming for Silverlight in the past, most of this will be familiar to you, but I still recommend that you skim through it for the Windows Phone-specific parts. The chapter describes the various controls available to you for your app's user interface and also gives a look into the basics of data binding which is important for the later chapters, as MVVM thrives on data binding. The only comment I have with the chapter is in the part for PhoneApplicationFrame. As a general rule, there are only a handful of times when setting the Content property of PhoneApplicationFrame is a more appropriate option then using the Navigate() function. If anyone disagrees with me on this, I would like to hear your argument for the contrary.
The second chapter deals with best practices when trying to design your app. The first part of the chapter is focused on just trying to think through your app idea, what you want to do with the app and how you want to accomplish it. As someone who has tutored underclassmen computer science majors at the college level, I always try to stress that you never get your program requirements and just start coding away; you have to think first and then start coding once you have your "plan of action" for your program in place. It also looks at the various "methods of navigation" that your app can use. On the pivot section, that could be simplified a little more. The Pivot control is made up of PivotItem controls and the user swipes in either the left or right direction to switch between PivotItem controls. Each PivotItem has a header used to identify it and its content can only contain 1 child. Visual Studio has a template for a PhoneApplicationPage with a Pivot control in it all ready to go. In the best practices section for Pivot and Panorama controls it makes a good point in avoiding content that scrolls if possible (if not, you should be fine with vertical scrolling , but not horizontal scrolling at all). Fonts and tiles are also touched upon.
The third chapter dives into MVVM. When you create a new Windows Phone application (with data?) project in Visual Studio, Visual Studio will try to organize files for MVVM. How you organize everything is up to you. In the model section, I noticed it uses the CallerMemberName attribute for the RaisePropertyChanged() function. Their example is different then how I have implanted my models with INotifyPropertyChanged interface. I have usually implemented it as
public string sampleProperty { get { return sample; } set { sample = value; RaisePropertyChanged("sampleProperty"); } } private void RaisePropertyChanged(string propertyName) { if(PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName); } }
with the book omitting the parameter on the call to RaisePropertyChanged(). To show the difference, see the following:
public string sampleProperty { get { return sample; } set { sample = value; RaisePropertyChanged(); } } private void RaisePropertyChanged([CallerMemberName] string propertyName = "") { if(PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName); } }
The chapter also covers other things applicable to MVVM such as ObservableCollection<T> for collections in binding view models, data templates for the Listbox control and other controls which use ItemsControl, and Value Converters for those types which just don't work by themselves in XAML such as DateTime. Not only that, but MVVM Light is also covered in detail. Unit testing for Windows Phone is covered so you can create unit tests for components in your Windows Phone app.
The fourth chapter deals with integration with the Windows Phone system. Writing to isolated storage (both file and settings), launchers and choosers, the two kinds of background agents, toast notifications, and live tiles are covered in detail. Something to note is that while you can use IsolatedStorageFile in a Windows Phone 8 app like you can in Windows Phone 7 (actually, that's the only way you can write files to storage in Windows Phone 7), Microsoft has enabled part (probably most) of the filesystem api found in WinRT in Windows Phone 8 as well. The newer filesystem api is what should be used from now on in a Windows Phone 8 app. For live tiles, ShellTile.ActiveTiles.FirstOrDefault() will always return the primary tile, whether it's pinned to the start screen or not. To search for a given (secondary) tile, you can use ShellTile.ActiveTiles.First() or ShellTile.ActiveTiles.FirstOrDafault() with a lambda expression such as ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("texttosearchfor"));.
The fifth and final chapter is devoted to integration with social networking. The two social networking services covered in this chapter are Facebook and Twitter. The Facebook section is good except for one thing left out. In the dyamic-type data received from the GetTaskAsync() function of the FacebookClient class, it is possible to cast that (or parts of it) to either a List<T> or a Dictionary<T1, T2>, and yes, it can be debugged it in Visual Studio too. In the Twitter section, they use a library called "TweetSharp" in the book, but I have used a library for Twitter access called "LinqToTwitter". Each one has its pros and its cons. No matter which library you use to connect to social networking services, you can always find more information via the documentation of the library you are using.
In closing comments, I am surprised that they didn't cover styles for controls in the basics section. However, there are enough resources on the internet that cover that anyway. Overall, it gives a good start for someone who is just starting Windows Phone development. The book is available at http://www.packtpub.com/windows-phone-8-application-development-essentials/book.