This document provides an overview and agenda for a presentation on developing apps for Windows Phone 7 (WP7). It covers the key aspects of the WP7 development environment including the UI framework, data binding, accessing and storing data, and the available tools. It also briefly outlines Microsoft's roadmap for Windows Phone 8, including planned hardware and software improvements as well as efforts to strengthen the app ecosystem and market share. Some current weaknesses of the WP7 platform are also noted.
9. Weaknesses
• Market Share
• Cross app communication
• Bluetooth API
• Office integration doesn’t exist (nor file
viewers)
Notes de l'éditeur
This presentation covers the strengths of the Windows Phone 7 platform when compared with Android and iOS. It is not an exhaustive talk on Windows Phone 7 (i.e., it won’t show you how to drop a browser control on your app or listen to accelerometer events), but it will give you a sense of how the WP7 platform compares to it’s competition.\n\n\n\n
In this talk, we will walk through a sample MVVM based application, focusing on the various applications layers. We then discuss Windows Phone 7 platform “shell” - the operating system features that we can use to integrate our application into the rest of the Windows Phone 7 OS. We also look into the platform tools, including the application profiler and the marketplace test tool. We conclude by looking at the roadmap of WP7, how it plays into Windows 8, and general direction that has been leaked in the press regarding Windows Phone 8.\n
From Visual Studio 2010, create a new data binding application.\n\nWindows Phone 7 is based on Silverlight - therefore it uses the same XAML based layout engine that is found in Silverlight and WPF. When designing XAML, you should have the mindset of an HTML developer - create the layout and data elements, use styles that are defined in resource files (i.e., CSS), and have the code-behind files control the interaction between the rest of the system and the UI (i.e., javascript).\n\nWindows Phone 7 has a box model (padding, margin) and layout is relative to it’s parent controls (think HTML).\n\nDynamic layout in iOS is a real pain. Creating a “grid” in iOS results in reams of hand written layout code. From the new data binding application, lengthen the text and illustrate the simplicity of dynamic layout.\n\n* Remove Height property on listBox - show dynamic layout\n* Add TextTrimming=Trim in title (show truncation).\n\nResources \n\nResources are containers at the application and page layers that we can use to put templates and other state that can be reused. Resources can include styles, strings, or any other object we would like.\n\nStyles | Templates\n\nSimilar to CSS, we can define styles that we can reuse across controls. We can also define templates (i.e., the layout of a listbox) that can be reused across multiple controls. iOS has no concept of control styling.\n\n \n \n\n\n
Binding allows us to link two objects together. In Windows Phone 7, any &#x201C;DependencyProperty&#x201D; on a UI control can be bound to a property on another object. For example, we can bind the TextBox &#x201C;Text&#x201D; property to a &#x201C;FirstName&#x201D; property on a &#x201C;Person&#x201D; object.\n\nEstablishing a binding relationship only takes a few steps:\n\n1. Create an object that implements INotifyPropertyChanged. For lists, use ObservableCollection<T>. The binding infrastructure uses the INotifyPropertyChanged event to update the other side of the binding relationship.\n2. Assign a &#x201C;DataContext&#x201D; of a UI element to the object. Note that DataContext cascades the object tree. A UI element will inherit the DataContext of it&#x2019;s parent element if it&#x2019;s DataContext property is not set.\n3. Set the &#x201C;binding&#x201D; property of a UI control to point to a property of the object in the data context.\n\n* Property Path: allows you to bind to nested properties.\n* Mode = OneWay (default), TwoWay, OneTime\n\nValidators and Converters:\n\nValidators allow us to validate and convert data. By specifying a validator on the binding relationship, the validator will validate the value prior to assigning it to the other side of the binding relationship.\nConverts allow us to convert the binding value when going to/from it&#x2019;s original value. For example, a DateTime object can be converted to a custom string format when being presented to the UI and is converted from the custom string format when being sent back to the data source.\n\n\n
LINQ is a powerful language feature of C# that allows you to write queries against an object model. For example, using LINQ, we can filter and sort a collection using a custom predicate function (for filtering) and a custom comparator (for sorting). \n\nLINQ to SQL is an ORM tool that allows us to define classes that represent data and gives us the ability to query into the database via LINQ queries. \n\nLINQ to SQL cliff notes:\n\n1. Create a class attributed with [Table]. Create properties attributed with [Column].\n2. Create a DataContext that includes those tables.\n3. Write queries that use the DataContext to do CRUD operations against the tables.\n\n\nVersioning:\n\nWP7 provides a &#x201C;DatabaseUpdateSchema&#x201D; object which allows us to add tables and/or columns to an existing database. It also has a &#x201C;Version&#x201D; property that we can use to determine and change the database version.\n\nWarning:\n\nBy default, all objects obtained through a DataContext are tracked. Thus, when you call a &#x201C;save&#x201D; on the DataContext, all objects retrieved from the context will be updated in the database. You want to ensure only the objects you *want* updated are actually updated. Create a &#x201C;write&#x201D; data context that you use to retrieve and save only the objects you want. \n
* Shell Tiles :\n\nShell Tiles (live tiles) are really simple to implement. You can create a shell tile that has a URI pointed to a specific page in your application (MS calls this &#x201C;deep linking&#x201D;).\nYou can also set properties for both sides of the tile - the OS will flip the tile automatically - you can&#x2019;t control the flip schedule.\n\n* Application Tiles | Secondary Tiles\n* Front | back w/ no animation.\n* In WMAppManifest.xml : the token property is what controls the main app tile (it&#x2019;s a template).\n* Double wide tiles (TemplateType6) are only available to Microsoft.\n* Could update from a background task (weather | news | poll server | etc)...\n* Secondary tile : only one tile per time | URI must be unique | User taken to homepage.\n\n* Backgrounding\n* Background agent.\n* http://msdn.microsoft.com/en-us/library/hh202962(v=vs.92).aspx\n\n* Trial Mode\n* iOS and Android sorely need this functionality.\n* There is a simple &#x201C;IsTrial&#x201D; property that is set when the app is downloaded in trial mode. Use this flag to change the app&#x2019;s functionality appropriately.\n* IsTrial will only be set properly after deployed to the marketplace.\n* Use a #if DEBUG flag to set IsTrial to true during development to test trial mode.\n\n\n\n\n
Profiler:\n\n* Very scaled down version of Apple&#x2019;s instruments program. \n* Instruments is much better because it is real time and the statistics you can gather are *much* better.\n* You can at least drill into the call stack and see where the application is slow.\n\nMarketplace Test Kit:\n\n* A very basic set of automated (and manual) tests you can run before submitting to the Marketplace which verifies your application for known marketplace metrics.\n\n
Windows Phone 8 is gearing up to be a pretty big overhaul. The overall goal of WP8 seems to be aligning WP with Win8. The underlying library stack may change to WinRT, however MS is promising silverlight backwards compatibility. (They really have to provide backward compatibility or they would cut off all apps in their store). \n\nThe ecosystem is going to change. Zune will die, skydrive will become more integrated.\n\n\n
WP7 Marketshare is really low (estimates place it at 2% of the market). \nObviously Microsoft will be making a play to improve Windows Phone marketshare by aligning it with Windows 8 and more hardware should start to become available.\n\nThey do not offer bluetooth support - Android is by far the best at Bluetooth support - going so far as implementing some protocols (Continua for healthcare devices).\n\nOffice and Windows &#x201C;back office&#x201D; integration is sorely hurting - they obviously tried to position this at the consumer market.\n\n