# Friday, January 06, 2012

Windows Phone Update due shortly

Microsoft have published details of a new update (7.10.8107.79) which adds a number of fixes to the Mango release. It fixes the issue where the on screen keyboard will randomly hide itself which I've been finding frustrating recently and also a fix for the SMS bug which could disable messaging. It also hopefully finally resolves the issue when forwarding Exchange messages where the original message body would disappear. It hasn't shown up yet but expect it over the next couple of weeks. Full details on all the updates and fixes are published here:-

http://www.microsoft.com/windowsphone/en-us/howto/wp7/basics/update-history.aspx

#    |

Windows Phone Update Due Shortly

Microsoft have published details of a new update (7.10.8107.79) which adds a number of fixes to the Mango release. It fixes the issue where the on screen keyboard will randomly hide itself which I've been finding frustrating recently and also a fix for the SMS bug which could disable messaging. It also hopefully finally resolves the issue when forwarding Exchange messages where the original message body would disappear. It hasn't shown up yet but expect it over the next couple of weeks. Full details on all the updates and fixes are published here:-

http://www.microsoft.com/windowsphone/en-us/howto/wp7/basics/update-history.aspx

#    |
# Thursday, December 22, 2011

Developer Unlock Expiry

When you've developer unlocked your Windows Phone you can merrily deploy and debug on it and everything is great. If you've upgraded to Mango you had to run the Unlock tool again but this is fairly painless. What is not obvious is that the developer unlock has a 12 month expiry from when you first register the device and even when you subsequently use the unlock tool on the same device this never gets extended.

So one day you'll be developing as normal and get the error "Failed to connect to device as it is developer locked. For details on developer unlock, visit http://go.microsoft.com/fwlink/?LinkId=195284.". Instictively you launch the developer unlock tool, enter your App Hub credentials and unlock the phone. This completes with no errors but you'll soon find that it hasn't helped despite the fact you entered valid credentials and your App Hub account is valid.

The solution to this problem is to log into App Hub on the web and go to your account profile, select devices and remove the offending device from the list (here you'll see that the expiry date is shown). After doing this you can run the unlock tool again and successfully unlock the device.

Microsoft could certainly improve this process in the future by using a more descriptive error message and also by improving the unlock tool so that when you try to unlock a device that has expired it refreshed the registration and provide 12 more months of use (just like the manual process described above does).

Merry Christmas, and here's to a wonderful 2012 filled with Windows Phone goodness!

#    |
# Thursday, December 08, 2011

Submitting Apps to Marketplace with Background Tasks

I've been working on an update to the Tasks application which adds in background synchronisation using the new background task support in Windows Phone 7.5. As with any app when you submit your XAP static analysis is performed on it to check, for example, that you have declared the correct capabilities based on the functionality in your app. Within a background agent you are only allow to call a subset of APIs - as you would expect you can't play sound effects or draw to the UI (with the exception of toast notifications and tile updates). Because the main app has to include a reference to the dll which provides the background task, and the functionality within the dll is used in both the background task and the main app it made sense to move all of the logic into the background dll. This meant including a number of third-party references. I was very careful to ensure that nowhere in the background task was any restricted API called and it worked perfectly in testing.

The first problem is that upon submitting the static anaylsis looks at all of the referenced dlls and sees that they contain APIs not permitted in a background task and blocks the XAP. One of the culprits was InTheHand.Phone.dll (Part of Mobile In The Hand) because it provides a mixture of helper classes for logic and for UI. As I've been working on the 7.1 version in tandem I've now split this into two assemblies for Windows Phone 7.1 SDK projects. This means we can continue to use InTheHand.Phone in background tasks and add a reference to the second assembly in the main application only.

The second problem is that code within the sync logic calls ScheduledActionService.Add which is disallowed within a background task. This API is used within Tasks to add system-wide reminders (Another new feature for this version) for new task items. The code also has the ability to update and delete reminders based on modified or deleted tasks but these do not seem to have been flagged up as errors. This is a pain because it means that if the device syncs a new task with a reminder set to show before you next open the foreground app we won't have had a chance to register it.

The other issue with the NeutralResourceLanguage is an issue with projects originally created with an older version of the development tools. You can add this setting from the projects properties, Application tab and click "Assembly Information...".

This has been an interesting learning experience and shows that the validation picks up not just APIs used in the background agent code-path but also in referenced assemblies.

#    |
# Wednesday, September 21, 2011

Showing Mango Features on Marketplace

The Windows Phone team have posted to their blog about application updates with a couple of useful points:-

From October you will again be able to publish updates to your 7.0 apps independently from 7.5 (previously once you had published a Mango update your 7.0 app would be locked). It does mean potentially being in limbo for a month but at least you are not stuck completely with no way of updating a 7.0 app. This is important as it will take some time before many users will have the opportunity of upgrading to Mango.

When submitting apps there is only one description for both versions of your app so you must describe which features are for Mango only. For the purposes of Screenshots there is now an officially accepted overlay which can be used to indicate Mango-only functionality. You can download a ZIP containing the overlay and examples here:-

http://create.msdn.com/downloads/?id=882&filename=Marketplace_7.5_Badges.zip

The full blog post is here:-

http://windowsteamblog.com/windows_phone/b/wpdev/archive/2011/09/20/submit-windows-phone-7-5-apps-today-update-7-0-apps-in-october.aspx?utm_source=twitterfeed&utm_medium=twitter

#    |
# Monday, September 12, 2011

Working with Marketplace Exported Reports

When Microsoft refreshed the Windows Phone developer portal in advance of the Mango refresh they added various improvements to reporting, an important one being export to file (XLSX). When you open the exported payout detail reports in Excel and enable editing you'll see a number of warnings against a couple of columns. This is because the data is formatted as text but Excel recognises that the contents are numbers. In order to use these values in formulas or graphs you'll need to convert them to numerical values.

The easiest way I found to do this was to select an empty cell and Copy it, then select the entire columns of "Units Sold" and "Royalty", right click and select "Paste Special". From the popup select "Add" as the operation and click "Ok". Now all your number columns are really numbers (you'll see the formatting change to right alignment).

#    |
# Tuesday, June 28, 2011

Need a Windows Phone developer handset?

Are you a Windows Phone 7 developer in New Zealand? Are you in need of a real Windows Phone device to test and debug your apps on? If so I have a spare Samsung developer handset which is going free to a good home. Shipping is $5 to anywhere in New Zealand. I could ship it internationally but the cost would be higher. Contact me if you are interested. I have only one and it’s first come-first served!

Update - The phone has now been claimed

 

#    |
# Thursday, April 21, 2011

APPA Mundi Tasks 1.9

The latest version of our Tasks app has now hit Marketplace. This release builds on the improvements from my last blog post:-

  • We now have fixed an issue some users were encountering with synchronising Hotmail tasks in v1.8
  • We now support a wider range of Exchange Server 2003 mailboxes including those with non-standard security policies
  • Thanks to user-feedback we’ve improved the French and German text within the application
  • We’ve changed the timing of how the welcome message pops up in the trial version to avoid navigation issues
  • Based on user feedback we’ve added the option of putting undated tasks at the top or bottom of your To-Do list
  • Since version 1.7 we’ve changed the transition animations between pages to match the built-in applications (obviously this doesn’t come across in the screenshots!)

We’d like to say thanks for all the great feedback we’ve received from users. We’ll keep listening and adding to the product so keep it coming!

#    |
# Friday, April 15, 2011

Geocoding and Reverse Geocoding with Mobile In The Hand 7.0

This is the first in a series of posts about Mobile In The Hand 7.0 which brings a collection of reusable components to the .NET Compact Framework. This latest version is updated to support all versions of Windows Mobile including Windows Embedded Handheld, All versions of Windows Embedded Compact (in it’s various names) from 4.1 to 7.0 and a set of companion libraries offering a subset of the functionality on Windows Phone 7.

When the .NET Framework 4.0 was released it introduced a new namespace – System.Device.Location which provided a range of location features. Subsequently this was used as the model for Windows Phone’s APIs. One major whole in the Windows Phone implementation is that the CivicAddressResolver is not implemented and doesn’t return a result. Mobile In The Hand 7.0 comes to the rescue with a two pronged attack:-

An InTheHand.Device.Location.GeoCoordinateWatcher for the .NET Compact Framework. This uses the GPS Intermediate driver present on all Windows Mobile 5.0 and later devices and available as a system component on Windows CE 6.0 and beyond. This is exposed with a familiar object model which matches that found in .NET 4.0 and Silverlight for Windows Phone.

Secondly two new components are provided – BingCivicAddressResolver takes a GeoCoordinate and uses Bing Maps to resolve a CivicAddress object similar to the functionality available on desktop windows. Additionally as an extra feature the BingGeoCoordinateResolver allows you to resolve a GeoCoordinate from an address or partial address. Both of these classes are provided in the .NET Compact Framework and Silverlight for Windows Phone libraries which make up Mobile In The Hand 7.0. The Compact Framework version offers both Synchronous and Asynchronous calls, the Silverlight version just exposes the Asynchronous calls.

#    |
# Wednesday, April 06, 2011

Tasks: Coming in v1.7

This week we released the second in a couple of updates to the Tasks application. We’ve added a large number of features and improved compatibility with a wider range of servers based on user feedback. Let’s look first at compatibility – we now support Exchange 2003 and other ActiveSync 2.5 compatible servers. This includes your Hotmail To-do list! We received feedback that a lot of users still had Exchange 2003, one of the main reasons for this is that this was the last Exchange version to support a 32-bit OS and many people have 32-bit Windows Server 2003 and Small Business Server 2003 machines which they have no immediate plan to replace.

Trial Version

The next common piece of feedback was in the functionality of the Trial version. we’ve removed the restriction on the number of Tasks which the application will sync. Because the app used to synchronise the first 10 tasks these were rarely the latest and most useful tasks to have on your phone. The trial app is now limited to run for 7 days to let you evaluate the application.

New Features and Fixes

We have improved the logic behind our live tile so that it’s updates should appear in a more timely manner. When it receives an update it also uses your chosen accent colour:-

colour-tile

We’ve made numerous tweaks to the user interface within the application too. We also respect your theme colour throughout the application, and have added some new transition animations between pages which closely match the experience in the built-in Email and Calendar applications which Tasks is designed to complement. We’ve made category editing easier by using a picker control to easily select existing categories as well as support for adding new categories.

We’ve had support for editing Reminders on the phone in the last couple of versions but we’ve now added reminders within the application. When you launch the application it will display currently due reminders and others will pop up as they become due when you are using the application.

reminder

We’ve added support for completing recurring tasks and the application will show both the completed instance and the next task in the pattern (if applicable).

Thanks to feedback from several users we’ve also made improvements to the localised text – yes the application supports all Windows Phone languages (US English, UK English, French, German, Italian and Spanish).

We’ve also made numerous bug fixes and some performance improvements. There were some issues around sorting, specifically where several tasks had blank subjects, these are now resolved.

 

Exchange 2010 Synchronisation Fix

One issue we have encountered can be observed if the app shows “initializing…” and then immediately “synchronization failed” when you try to sync. This seems to be specific to Exchange 2010 and can be resolved by removing the device from your Exchange account using Outlook Web Access and then resetting synchronisation.  From OWA click Options and “See all options…” then select Phone in the left-hand list. You’ll see a list of mobile devices attached to your account. Your Windows Phone will have an entry and the Tasks application will have a separate one. To find the correct device select one and click Details. You can identify Tasks because it will show the user-agent as APPA-Mundi-Tasks/x.x.x.x where x.x.x.x is the version number.

owaproperties

Once you’ve identified the correct device delete it from the list, log out of OWA and from the Tasks application go to the Settings page and click Reset. The application can now setup a new sync relationship.

#    |
# Tuesday, April 05, 2011

Windows Phone 7: Localisation and Windows Phone Features

Anyone who has built an application for Windows Phone 7 in multiple languages will know there are three parts to the process. Within your application you can use managed RESX resource files to provide localised strings. For your application title or the initial text for your Live Tile you must use native resource dlls. Then when you are ready to submit your application to Marketplace you’ll need to provide descriptions, keywords and screenshots tailored for each supported language. At the moment there are six possible languages on the device side:-

  • English (United States)
  • English (United Kingdom)
  • French
  • German
  • Italian
  • Spanish

On Marketplace there are five languages – English (International) is used to cover both variants above. Even if your icon is standard across all languages you still have to submit it with each language as you upload to Marketplace.

There are several ways you can get your text translated, however one thing we noticed from experience is that certain features have established names in these different markets which may not equate to a direct translation from the English. Because the emulator and all retail Windows Phone 7 devices support all six languages you can easily change your device language and see how your application looks.

Feature names

For my future reference (and for yours) I’ve included a table below of some of these which may be useful. As I compile a list of more common words and commands I’ll add them to the table:-

English French German Italian Spanish
Start screen Écran Démarrer Startseite Start Screen Pantalla Inicio
Live Tiles vignettes dynamiques Live-Kacheln riquadri animati ventanas vivas
People Contacts Kontackte Contatti Contactos
Pictures Photos Bilder Foto imagenes
Games Jeux Spiele Giochi Juegos
Marketplace Marketplace Marketplace Marketplace Marketplace
Email E-mail E-Mail E-mail Correo electrónico

 

Common Controls

See also my previous post with localised resources for the Silverlight Toolkit which localises the Date/Time pickers and ToggleButton controls. This also works with the latest February release of the toolkit, simply use this destination folder:-

C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Toolkit\Feb11\Bin

The exception which proves the rule

Finally another observation which is specific to German. While the UI normally displays pivot headers and toolbar/menu text in lower-case this is not true for German where items should be capitalised.

#    |
# Tuesday, March 29, 2011

Windows Phone 7: More Tilt Effect

The Silverlight Toolkit for Windows Phone (Latest version is February 2011) contains a Tilt Effect implementation. To add it to your controls requires the addition of an XML namespace definition and one dependency propery set in your page XAML.

<phone:PhoneApplicationPage

…etc…
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    toolkit:TiltEffect.IsTiltEnabled="True">

 

However the implementation doesn’t apply the effect to all the same places as you will find it in the native application. So far I’ve identified the ListPicker and MenuItems within the ContextMenu control. You can add additional types to receive the Tilt effect and I’ve raised an issue in the CodePlex project so hopefully this will be addressed in the next update. In the meantime you can add the following to your App constructor:-

TiltEffect.TiltableItems.Add(typeof(ListPicker));
TiltEffect.TiltableItems.Add(typeof(MenuItem));

By itself I found that this didn’t actually fix the ContextMenu and the items do not tilt as they do in built in applications. However all is not lost! If you apply the property to each entry in your ContextMenu it does use the feature:-

<toolkit:ContextMenuService.ContextMenu>
   <toolkit:ContextMenu>
      <toolkit:MenuItem toolkit:TiltEffect.IsTiltEnabled="true" Name="firstMenuItem" Header="edit" Click="FirstMenuItem_Click"/>
      <toolkit:MenuItem toolkit:TiltEffect.IsTiltEnabled="true" Name="secondMenuItem" Header="delete" Click="SecondMenuItem_Click" />
   </toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>

Once you’ve done this you’ll have a context menu which behaves closer to the built in control. The Silverlight Toolkit is a great resource for additional controls and features which are not present in the Windows Phone 7 SDK. As always I’m eagerly awaiting the next update!

#    |
# Sunday, March 27, 2011

When Phone Tasks Might Not Work

The range of Tasks available in the Microsoft.Phone.Tasks namespace call into various system features from your application. In some circumstances these may not work as expected. The most obvious example is the Emulator where not all of the system is implemented. The behaviour will differ depending on the specific task. For example EmailComposeTask on the emulator will display a message that no accounts are setup and of course you cant create these yourself because this functionality is hidden in the emulator. The other situation which can cause tasks to fail is when your device is docked with the Zune software. As a developer there is a tool to get around this when debugging but you must write your software to be aware of this to avoid upsetting users. In Windows Mobile we would have used SystemState.CradlePresent to detect when the device was docked, there isn’t an equivalent property for Windows Phone. Instead you can check the network type. Because we know that the hardware configurations for Windows Phone 7 are quite specific we know that devices will have phone, wifi and USB cable connections. You can detect the network type using the Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType property. There are a lot of possible values in the NetworkInterfaceType enumeration but only a few are relevant:-

Ethernet – Used for Zune cable connection

MobileBroadbandCdma

MobileBroadbandGsm – For phone connections

Wireless80211 – For WiFi

So by checking for the value Ethernet we can tell if the device is currently docked. The only caveat is that this property isn’t set immediately when you dock and there can be a few seconds before the connection is established.

 

Case Study – PhotoChooserTask

The PhotoChooserTask works on the emulator with a selection of default images. On the phone it will fail if the phone is docked. The Completed event will be raised and a TaskResult of Cancel will be returned – as if the user had cancelled. This simple block of code can be used to wrap your call and handle this situation (for a change a little VB):-

If Not Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType = Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Ethernet Then
            Dim pct As New Microsoft.Phone.Tasks.PhotoChooserTask
            AddHandler pct.Completed, AddressOf pct_completed
            pct.Show()
Else
            MessageBox.Show("To view photos, disconnect your phone from the computer", "My Application", MessageBoxButton.OK)
End If

 

Task behaviours

Task Name Emulator Phone (Docked)
CameraCaptureTask Yes (simulated data) No (Completed returns TaskResult.Cancel)
EmailAddressChooserTask Yes Yes
EmailComposeTask Shows error message (no account) Yes
MarketplaceDetailTask Exception 80070057 No
MarketplaceHubTask Exception 80070057 No
MarketplaceReviewTask Exception 80070057 No
MarketplaceSearchTask Exception 80070057 No
PhoneCallTask Yes Yes
PhoneNumberChooserTask Yes Yes
PhotoChooserTask Yes (Sample data) No (Completed returns TaskResult.Cancel)
SaveEmailAddressTask Yes Yes
SavePhoneNumberTask Yes Yes
SearchTask Yes Yes
SmsComposeTask Yes Yes
WebBrowserTask Yes Yes

The marketplace tasks perform no action and these ones don’t have a Completed event so you don’t get any feedback. You can provide similar logic to the above to warn the user that they can’t use Marketplace functionality when docked, you could also hide any marketplace links from your UI based on the network state.

#    |
# Friday, February 18, 2011

Silverlight for Windows Phone Toolkit–Feb 2011

The latest release of the Silverlight Toolkit contains a number of fixes and new features including:-

TiltEffect (previously available separately)

PerformanceProgressBar (previously available separately)

Visual Basic Samples

Major improvements to LongListSelector and Transitions

 

Go grab the latest release here:-

http://silverlight.codeplex.com/releases/view/60291

#    |
# Tuesday, February 08, 2011

Copyable TextBlock for Windows Phone

The latest update for Windows Phone 7 adds automatic support for Copy and Paste to TextBox controls in your application. By default this means you can’t copy text from static TexBlock controls. There is however a solution which requires minimal changes to implement. You have to replace the TextBlock control with a TextBox and set the IsReadOnly property to true. At first glance this will totally ruin the look of your application – even if you set custom background/foreground colours the control will display in grey on grey when IsReadOnly is true. It is possible to change this behaviour by applying a custom template to the control. Originally I did this in Blend but I found it had generated much more XAML than absolutely necessary so I set about removing redundant parts to result in this:-

<ControlTemplate x:Key="PhoneDisabledTextBoxTemplate" TargetType="TextBox">
            <ContentControl x:Name="ContentElement" BorderThickness="0" HorizontalContentAlignment="Stretch" Margin="{StaticResource PhoneTextBoxInnerMargin}" Padding="{TemplateBinding Padding}" VerticalContentAlignment="Stretch"/>
</ControlTemplate>

Simply add this to the Resources collection for your page.

Then your TextBox is customised like so:-

<TextBox Grid.Row="1" Name="TextBlockCopyable" IsReadOnly="True" TextWrapping="Wrap" Foreground="{StaticResource PhoneForegroundBrush}" Template="{StaticResource PhoneDisabledTextBoxTemplate}" Text="We provide software solutions for a mobile world. We have unrivalled expertise in designing, developing and supporting mobile software for Windows Phone and Windows Embedded." FontSize="{StaticResource PhoneFontSizeMedium}" />
           

The result looks and behaves like a TextBlock and still follows your system theme but allows copying on the latest emulator:-

copyableTextBlockcopyableTextBlock2

I created a sample project with all of the code showing the different behaviours of the TextBlock, read-only TextBox and customised TextBox which you can download here:-

http://appamundi.com/files/uploads/CopyableTextBlock.zip (44kb)

#    |
# Tuesday, January 25, 2011

Tasks Frequently Asked Questions

Since we have released a couple of updates for the application we have updated the Frequently Asked Questions for the Tasks application and moved them to a new location:-

http://appamundi.com/tasks-faq/

If you have any issue with the application or question this should be your first port of call. If your issue is not described here please send us an email with as much detail describing the issue as possible and we will work with you to resolve it.

Finally remember we do provide a Trial version of the application which lets you test whether the app works with your specific Exchange Server configuration.

#    |
# Monday, January 24, 2011

Win a Windows Phone 7 LG E900

Following my review of the LG E900 handset we have the opportunity for one lucky winner to get a Windows Phone 7 of their own. All you need is a little creativity and this handset could be on its way to you! See the contest page for the full details:-

http://appamundi.com/win-a-windows-phone-7-lg-e900/

 

Good luck!

#    |
# Wednesday, January 19, 2011

Localised Resources for Silverlight Toolkit Nov 2010

Due to the absence of a built-in DatePicker control many are using the Silverlight Toolkit which has a Silverlight implementation to match the control used in the native applications. One limitation in the current release is that the UI is only available in English. The day/month names are retrieved based on the device locale but the page header and text labels for buttons are always in English. I had a look at the code to implement a fix, interestingly I found that the strings were already stored in resource files, it’s just that there were no resources for other languages. I’ve submitted a set of .resx files to cover all the currently supported Windows Phone 7 languages so hopefully my patch will be integrated in a future release. I’ve also discovered that by creating my own localised resource dlls from the latest source I can use them against the current release binary. We are sharing these files for other developers who use these controls and write multi-language software for Windows Phone. To use these simply copy the contents of the ZIP file into the install folder for the November 2010 toolkit on your machine which will be somewhere similar to “C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Toolkit\Nov10\Bin”. As a bonus these resources also localise the On/Off text on the ToggleButton control.

If you’ve not attempted building a localised application before have a look at this article on MSDN - http://msdn.microsoft.com/en-us/library/ff637520(v=VS.92).aspx. Mostly this involves standard RESX editing but for Windows Phone you have to make a minor edit to your project file with a text editor, hopefully this can be fixed in a Visual Studio Patch/Service Pack.

Download AppaMundi.Phone.Controls.Toolkit.Nov10.Resources.zip

#    |
# Monday, January 17, 2011

LG E900 Review

I have had a fair bit experience with the test devices which were available prior to the release of Windows Phone 7 but this is my first experience with a commercial device. Therefore it seems inappropriate for me to try and compare this device with other hardware or even to look at the WP7 OS itself as I’m sure you are already familiar with the standard features. Instead I’ve looked at the hardware under real day-to-day usage and had a look at features which LG has added to the phone.

Hardware

The device measures 12.5cm tall by 6cm wide and is about 12mm thick. The hardware buttons and arrangement are pretty standard. The row of buttons below the screen for Back, Start and Search are very tactile and give good feedback in use rather than some devices where buttons are built into the glass of the screen. The Start button specifically is a raised Windows logo which makes it very easy to navigate by touch if for example you are worried about walking into a fountain while using it (http://www.youtube.com/watch?v=mg11glsBW4Y&feature=player_embedded).

The back cover is dark lacquered metal and the sides are plastic and are easy to grip. Connectivity is provided via a micro-USB port on the right-hand side and there is a headphone socket on the top of the device and a wired headset is included.

Screen

The screen is 3.8 inches, very bright and clear indoors and quite usable outdoors too. I’ve recently tried the Kindle reader application on the device and found it quite comfortable for a few short reading sessions.

Camera

The camera is marked as 5.0 mega-pixels. For a phone the results were quite good but don’t be under the impression that this is comparable with a similarly spec’d digital camera. I’ve found myself more inclined to use the camera for quick shots now that WP7 has a shortcut to launch the camera from a locked state using the hardware button. The device has a small mirror on the back to help you take a self-portrait if you so wish and an LED flash which can be turned on or off or used automatically. LG have implemented custom settings in the form of “Photo Smart Settings” accessible from the Camera app which allows you to change between a number of 4:3 or 16:9 widescreen resolutions and adjust the brightness and white balance settings. There is also a link to Panorama Shot which is a cool utility to help you stitch up to 5 images together into a panorama. It gives you a live overlay on the screen to show you where to position the camera for the next shot. The results were quite impressive and because you have the finished panorama on the phone you can upload it to Facebook or SkyDrive or send in an email using the Pictures hub.

Battery Life

I’m not a heavy user or Wi-Fi or cellular data most of the time, as such I found I only had to charge the phone every other day. Turning off Wi-Fi and Bluetooth most of the time keeps battery usage to a minimum. Perhaps I’m unnaturally frugal based on my experiences with other phones so your experience may differ.

LG Applications

The device ships with some LG specific applications. Tiles are installed on the Start screen for three of these – ScanSearch, PlayTo and Panorama Shot.

The app I was particularly interested in trying was PlayTo which allows you to output to a DLNA compliant screen. We have a TV with DLNA support but have never really taken advantage of it. When you first run the app it will search for a compatible device. It soon found our TV and connection worked. The TV may have additional settings or a process to ask for permission when you connect a new device. We then have the option of playing Music, Pictures or Videos. I tested a few tracks of music from my device. I have a mixture of MP3 and WMA files and I found the TV refused to play the WMA files but worked okay with MP3. The track name and album art were also transferred which I wasn’t expected and it looked impressive, you can use the controls on the phone to skip tracks as well. Photos worked well with a couple of galleries including photos taken on the device. You can browse a carousel of images on the device and select them to be sent to the TV. Videos were not so successful. First I tried playing a video clip captured on the device and it would not play. I suspect this is because the TV doesn’t support the codec used but it is a shame. I would assume that being able to show videos you have captured would be the main use for this functionality. I guess this is a limitation with DLNA devices at the moment.

ScanSearch is an augmented-reality application which searches for a number of categories of places in the local area (restaurants, banks etc) and overlays them on screen over the live camera view based upon the compass in the device. Personally I’d prefer to see results on a map but having the map turn as you turn the device would be quite clever. This is obviously an OEM specific feature as regular developers have no access to the compass and can only read the Course from the GPS data which will only be accurate when you are moving.

Alongside the pre-installed applications there is a special area within the Marketplace for LG specific applications. There they make available a number of other apps for free (often for a limited period) from system utilities to a golf caddy.

Issues Encountered

The device shipped was customised for Vodafone Germany and so it had some features specific to that network. Also it showed a feature that OEMs are able to add an additional accent colour which in the case of Vodafone is their corporate red.

Because the device was built for the German market the initial boot occurs in German but it can be changed to any of the other currently supported languages – English (US or UK), French, Italian and Spanish. I found that when set to English a number of third-party applications which support multiple languages in the Tile and Application Name were showing a name in German. I don’t know if this is an issue with Vodafone Germany’s customisations or something in WP7 itself…

Wi-Fi has been somewhat unreliable for me. When it connects it’s great but after a while it will fail to reconnect and only restarting the wireless hub and the device can get it to reconnect. I have seen this with other devices so I suspect it is my wireless hub rather than the phone which is to blame.

Conclusion

This has been a great day-to-day device, it has a good sized screen and is slim. I found the battery lasted long enough for my usage. I like the fact that devices are standardising on the micro-USB port so I can carry a few different devices and one USB charger. I found the intermittent Wi-Fi issues annoying but I suspect my wireless hub is at fault so will investigate changing it. The LG specific features such as PlayTo and Panorama Shot are valuable additions to the OS and well integrated.

#    |
# Monday, December 13, 2010

APPA Mundi Tasks 1.0 – Frequently Asked Questions

We’ve received a lot of great feedback for the Tasks application so I thought it would be useful to provide some frequently asked questions (and answers) here:-

How secure are my credentials, do you send them to your own server?

Your credentials are only used to communicate with your Exchange Server directly using the Exchange ActiveSync protocol just like your Email and Calendar applications. We don’t use any proxy servers or other mechanisms.

How do I know exactly what settings to enter?

You can look at the settings associated with your Outlook email account and enter them as they are displayed there. See this previous post for details - http://mobileworld.appamundi.com/blogs/peterfoot/archive/2010/12/12/appa-mundi-tasks-your-exchange-server.aspx

I’ve entered my settings the same as for my Email client, I can sync email but Tasks will not sync.

This will happen if your server uses a version prior to Exchange 2007. We don’t support servers older than Exchange 2007 due to the way the protocol is licensed. In our forthcoming v1.1 update we have added a specific error message to make this clearer if an older version is detected.

I used the trial successfully and purchased the full version and it only shows the small number of tasks I had with the trial and says synchronisation complete if I try and sync

When you upgrade the app should force a refresh of the sync relationship which will bring back the entire collection from the server. If this doesn’t happen you can manually force a refresh by tapping the Reset button on the Settings page

I used the full version and synchronised successfully and exited the app, now it won’t load again

We’ve seen this happen in a few cases and have prepared a v1.1 update to resolve this which will be available shortly.

I use a Vodafone Germany LG Optimus device set to English, the app shows as “Aufgaben” in the programs list

This appears to be a quirk with the specific device. The application itself runs in the correct language but the application name will show in German. For other languages on the same device (French, Spanish and Italian) the application name will appear as expected.

Sometimes I make changes to Tasks (e.g. Completed) or changes occur on synchronisation but the Active and Completed lists don’t update

This is a known issue and is resolved in the v1.1 release which should be available in Marketplace shortly

#    |
# Sunday, December 12, 2010

APPA Mundi Tasks–Your Exchange Server

Below are some hints for setting up the Tasks application to synchronise with your Exchange Server:-

 

Exchange Server Settings

We have no way to use your settings already entered when setting up your Exchange Email account so it is necessary to enter these again. In order to setup synchronisation you’ll need your Username, Password, Domain (optional) and Server name. You’ll also need to know whether your server synchs over HTTPS (usually it does). Because Exchange Email supports an auto discovery process you rarely have to enter these full settings when setting up your email. Because also there can be a redirection process the actual server name can differ from what you first enter based on your Outlook Web Access address. The easiest way to get direct to the required settings is to look at the settings for your Exchange email account once it has been fully setup on the phone.

1. From the Start screen tap the –> to go to the programs list

2. Select “Settings”

3. Select “email & accounts”

4. Select your Exchange account e.g. “Outlook”

5. Scroll down and take note of your settings

6. If your login uses a domain it will be of the form “domain\username”

7. Make a note of the Server value – this is the address to the ActiveSync server

8. Note the value of the “Server requires encrypted (SSL) connection” box

 

Exchange Server Version

It is possible to determine the version of the Exchange Server you synchronise with by logging into your Outlook Web Access site and going to the Options page. In the list of Options screens you’ll see a version number e.g. 8.3. 8 represents Exchange 2007 with the .3 indicating the Service Pack 3 release. Exchange 2010 is version 14. The app supports Exchange 2007 and later.

 

Gmail

Although Gmail can be used as an ActiveSync server and the web interface exposes a Tasks list this is not exposed through ActiveSync so if you try to use this account and synchronise you’ll receive an error that the mailbox contains no Tasks folder.

 

Hotmail Tasks

Hotmail Tasks are not supported.

#    |
# Friday, November 19, 2010

Navigation Stack on Windows Phone 7

While Windows Phone uses the same NavigationService and page-based model as “regular” Silverlight, one area the documentation doesn’t make clear is that although the APIs seem to support both Back and Forward navigation in reality there is no forward navigation on Windows Phone. This means when you navigate to a new page and then return Back to the previous page you can’t call NavigationService.GoForward() to return. CanGoForward will always return False. In the documentation for System.Windows.Controls.Frame (the base class of PhoneApplicationFrame) GoForward is described as:-

“Navigates to the most recent entry in the forward navigation history, or throws an exception if no entry exists in forward navigation. For Windows Phone this method will always throw an exception because there is no forward navigation stack.”

(my use of bold)

And yet in NavigationService:-

“Navigates to the most recent entry in the forward navigation history, or throws an exception if no entry exists in forward navigation.”

It makes perfect sense because there is no mechanism to browse forward on the phone unless you add buttons/menus onto your pages manually of course, but the documentation doesn’t spell out this difference from “regular” Silverlight very clearly.

#    |
# Wednesday, November 10, 2010

Marketplace for Emulator

The Windows Phone 7 Emulator takes a fairly bare-bones approach having only Internet Explorer available by default. Because it’s easier when presenting to use the Emulator than to try and capture a device screen with a camera it would be nice to show off features of the platform as part of your demonstration – not just your own apps. We put together a simple XAP package to install a Marketplace client onto the emulator, this allows you to demonstrate the Marketplace experience (with live data) and even show your clients how their apps appear within Marketplace. You cannot download apps to the emulator as it will not allow you to sign in with a Live ID – this is provided purely for demonstration purposes. You can read more about the tool and download from here:-

http://appamundi.com/Products/EmulatorMarketplace

#    |
# Wednesday, October 27, 2010

Windows Phone Tools Update

Microsoft have released an October update for the Windows Phone Development Tools. This release fixes gesture behaviour in the map control and adds two developer utilities – one to analyse your application to detect which capabilities it requires, the other to allow you to connect using your desktop without Zune running allowing you to use media features on the phone while debugging.

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=49b9d0c5-6597-4313-912a-f0cca9c7d277

#    |
# Friday, September 17, 2010

Determine Light or Dark Theme with WP7 RTM

In the previous Beta release you had to compare the RGB values of the background brush to determine if the theme was Light (White background) or Dark (Black background). Now there is an additional resource you can query:-

Visibility v = (Visibility)Resources["PhoneLightThemeVisibility"];
 
if (v == System.Windows.Visibility.Visible)
{
    ImageBrush ib = new ImageBrush();
    Uri u = new Uri("PanoramaBack2.png", UriKind.Relative);
    ib.ImageSource = new System.Windows.Media.Imaging.BitmapImage(u);
    PanoramaControl.Background = ib;
}

Any time you use a background image you can check the PhoneLightThemeVisibility resource and switch between different versions of the image to provide the best experience with either Black or White text.

#    |
# Friday, September 10, 2010

Using Microsoft.Phone.Tasks in the Emulator

The Windows Phone 7 emulator is very limited compared with the real phones so there are no built in applications other than Internet Explorer. This can make it difficult to test some of the APIs which interact with data on the device. Luckily there is a way to load contact data onto the emulator which allows you to use these tasks as if you were working against real contacts from your Exchange server or wherever. The trick to this is that the system supports the vCard standard which allows you to attach contact items to emails or via the web. Internet Explorer understands vCard files and provides the option to save them in the People list on the phone. For example you can browse to http://inthehand.com/share.vcf to see how this process works. From within your application you can also use the WebBrowserTask (AFAIK it does not work when you host the WebBrowser control in your own app).

share-vcard

Tap the contact image to open in a new contact page:-

new-contact

You can make changes to the contact and then tap the disk icon to save.

When you close the emulator the contents are not persisted so you’ll have to repeat this each time you launch the emulator. Unfortunately this doesn’t appear to support vCard files containing multiple entries. However having just one entry in there allows you to test your app flow where you have a contact picking scenario.

If you want to test the PhotoChooserTask you can also import images to the emulator. Simply visit any website and tap and hold over an image – select “save picture” from the context menu which pops up. These are placed in a “Saved Pictures” folder.

The PhoneCallTask and SmsComposeTask work as expected (like the Windows Mobile emulators there is a fake mobile network). The EmailComposeTask does not work as there is no account on the emulator and no way to add one. When you launch it you’ll get an error popup.

#    |

Windows Phone 7 Development Workshops

Microsoft are running a series of development workshops across New Zealand (Auckland, Wellington, Dunedin, Christchurch and Hamilton) over September and October. Full details are on Nigel’s blog along with sign-up links. Places are limited so register today!

http://blogs.msdn.com/b/nigel/archive/2010/09/09/windows-phone-7-introductory-development-workshop.aspx

#    |
# Monday, August 23, 2010

DataContractSerializer and Internal types

Under Silverlight only public types may be serialized with the DataContractSerializer. If you want to make your data classes internal to your assembly and serialise them for use in a WCF service you will find that the service call will fail at runtime with a SecurityException inside a misleading exception about inability to communicate with the service. There is a workaround however which involves exposing your internal types to the Silverlight base class libraries with the InternalsVisibleTo attribute. Simply add the following code to your AssemblyInfo.cs file:-

  1. [assembly: InternalsVisibleTo("System.Runtime.Serialization, PublicKey=00240000048000009400000006020000002400005253413100040000010001008d56c76f9e8649383049f383c44be0ec204181822a6c31cf5eb7ef486944d032188ea1d3920763712ccb12d75fb77e9811149e6148e5d32fbaab37611c1878ddc19e20ef135d0cb2cff2bfec3d115810c3d9069638fe4be215dbf795861920e5ab6f7db2e2ceef136ac23d5dd2bf031700aec232f6c6b1c785b4305c123b37ab")]

If you use the DataContractJsonSerializer you must also add the System.Servicemodel.Web assembly (the public key is the same).

#    |
# Tuesday, May 04, 2010

WP7: Versions in April CTP

I was surprised when I first wrote a hello world application on the MIX CTP that the Environment.OSVersion.Version property was returned as 7.0 when all the media speculation was that it would be based on CE 6. I tweeted about it at the time but some sources are still saying that it runs a customised version of Windows Embedded CE 6.0 R3. However regardless of whether this is a version which pre-dates the eventual release of Windows Embedded Compact 7 (which will be the new name for the successor to Windows Embedded CE 6.0) and any other name changes (remember we have already had Windows CE, Windows CE.NET and Windows Embedded CE) I think it’s safe to say that the core OS in the product is version 7. As we already know Silverlight (and XNA) runs on top of the .NET Compact Framework 3.7 runtime. So just for curiosities sake here are the version properties retrieved in the latest April CTP release:-

April CTP Versions

#    |
# Saturday, May 01, 2010

WP7: Writing a Well-Behaved Threaded Application

The latest CTP release of Windows Phone 7 introduces a new managed library which exposes events you can monitor to catch changes in state in your application. The assembly is Microsoft.Phone.Execution.dll. This contains a WindowsPhoneEvents class which exposes two static methods – Pause and Resume. You can handle these events to detect when your application is dismissed and reactivated. This allows you to stop unnecessary processing and be a good citizen. I put together a simple example which shows how to pause a background thread based on these events and you can see the results by running it on the Emulator and switching to the home screen (Windows button) and returning to your application (Back button).

The sample uses a ManualResetEvent to block the background thread to avoid it consuming processor cycles while the app is paused.

WindowsPhoneThreading.zip (22kb)

 

Also in this assembly is the StreamPersister class. Unfortunately there is no documentation for this at the moment but an instance is passed in the Pause and Resume eventargs which will presumably allow you to safely persist state data which you can then load when your app is resumed. Hopefully there will be some official documentation on this to complete the picture.

#    |

WP7: New Capabilities Security Model

Jamie Rodriguez has a post on the new capabilities security model in Windows Phone 7 which is introduced in the latest CTP release:-

http://blogs.msdn.com/jaimer/archive/2010/04/30/windows-phone-capabilities-security-model.aspx

It is interesting to read how this will be handled at runtime, here are the key facts:-

  • If you try to use a feature and you didn’t specify the capability you’ll get an UnauthorizedAccessException when you first call that feature
  • There is no API to check if you have been granted a specific capability
  • The disclosure to the user will vary depending on the capability and marketplace – Either listed on the Marketplace page, a user prompt at purchase or a user prompt when the capability is about to be accessed.
  • A new project created in the latest CTP will request all of the currently documented capabilities (you can remove those you don’t need later)
  • There are other capabilities specific to OEMs and operators which are not documented
  • The table of example features lists a few items yet to be shipped in the developer tools giving an interesting insight into what is still to come – Microsoft.Devices.Radio and Microsoft.Devices.MediaHistory
#    |
# Friday, April 30, 2010

WP7: New CTP and a quick tip

If you haven’t already heard there is a new release of the Windows Phone 7 Developer Tools available which is compatible with the RTM release of Visual Studio. Before you install you need to uninstall the previous version and this is where you might have problems. See this tool for cleaning up your machine:-

http://blogs.msdn.com/astebner/pages/9544320.aspx

Okay, now you’ve safely removed the old bits you can download the new installer from here:-

http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=cabcd5ed-7dfc-4731-9d7e-3220603cad14

Read the release notes:-

release notes

In particular there is a breaking change if you open existing projects – the WMAppManifest.xml requires some extra items to describe the application’s capabilities. There is also an issue with including Authenticode signed dlls (this includes official Microsoft libraries), you can read more about it here:-

http://timheuer.com/blog/archive/2010/04/29/windows-phone-tools-update-april-2010-silverlight-xna.aspx

Check out an overview of what is new in this release:-

What's New in Windows Phone 7 CTP Refresh

 

Finally to end on a quick tip – Assuming you install on a machine without Visual Studio 2010 the “Visual Studio 2010 Express for Windows Phone” displays a simpler user interface than its big brother. You can quickly enable extra goodness by going to Tools > Settings > Expert Settings. This enables more menu and toolbar options and is definitely worthwhile if you are already familiar with Visual Studio.

#    |
# Tuesday, April 13, 2010

WP7: ApplicationBar CTP Issue

If you have read the UI Guidelines for Windows Phone 7 (If you haven’t, get it now) you notice that in the discussion of the ApplicationBar it states that a maximum of four icons can be added. I noticed inadvertently that if you add five icons in your XAML your app will compile and run but only the first four are shown. If you add a sixth icon the designer will present you with an error:-

appbar6items

It appears that this is a bug in the current CTP release and the control should support only adding four items. It previously supported five but this was reduced based on user feedback, obviously the validation in the current CTP is not strict enough but I expect this will be fixed in the next release.

#    |

KIN: A totally different Windows Phone

Microsoft announced a pair of new phone devices which will be manufactured by Sharp and branded KIN. These are not part of the Windows Phone 7 platform but are still (perhaps confusingly) called Windows Phone. KIN uses a lot of the same underlying technology as Windows Mobile has in the past and Windows Phone will do, however the device is sharply focussed on social networking and the whole user experience revolves around this. The platform has built in support for Facebook, Twitter and MySpace along with the accompanying KIN Studio online service. KIN Studio is a web portal which aggregates everything you create on the phone up in the cloud. It has some cool visualisation of this content too including a timeline view of everything you’ve done. Think of it as a kind of MyPhone on steroids…

16_web

The user experience uses some of the same principles as the Metro user interface visible in Windows Phone 7 however one thing that is instantly noticeable is there is a lot less dead space. Where Windows Phone 7 uses large fonts and generous spacing in a “less is more” approach the KIN user interface packs highly graphical elements closely together. It has been described as a magazine style and certainly tries to catch your eye with everything which is going on in your social networks. Both platforms use a minimal colour scheme – from the flash based demo on the website you can choose one of four highlight colours but these are different to the colours used on the “big brother” Windows Phone 7.

I’m looking forward to seeing the real device, and I hope that some of these innovations (particularly KIN Studio) make it into Windows Phone 7 too! I’m also wondering if there will be any development story for these devices as there is nothing mentioned on the official website or press releases…

#    |
# Friday, April 02, 2010

Introducing "Windows Phone 7"

Microsoft have announced via Twitter that they have officially dropped the epic fail "Series" from the product name. Many have been referring to it as "Windows Phone 7" or "WP7" already and the "Series" was the latest in a series (sorry) of Microsoft adding redundant words to product names to unnecessarily confuse the public...

#    |
# Friday, March 26, 2010

Audio Recording in WP7

Because it is possible to use the XNA libraries within a Silverlight project you can add audio recording in your application using the Microphone class found in the Microsoft.Xna.Framework.Audio namespace. You can test this on the Emulator as it will work with a microphone attached to the host PC.

First add a reference to Microsoft.Xna.Framework.dll to your project.

Next to make life easier add “using Microsoft.Xna.Framework.Audio;” to the top of your code file. You can access the Microphone through the static Microphone.Default property but for ease I created a local variable called m.

Next you need to decide what you are going to do with recorded audio. I built a simple audio memo application which stores the audio data in memory for instant playback. For simplicity I added MemoryStream to my app. I will write audio data to this and then I can easily get a byte array of the entire buffer to pass to the SoundEffect class to playback later. You could also write to a file in Isolated Storage or send to a web service…

In the constructor of my page I added an event handler for the BufferReady event of the Microphone. This is called each time the buffer is full and in the handler I copy the contents to the memory stream.

I created a Record button. I then set the BufferDuration on the Microphone object to 1 second (the maximum value), this is not strictly necessary as you’ll be copying data from the Microphone when it notifies you. Then I call Start to open the Microphone and start recording. Each time the buffer fills it is copied to the memorystream. When a Stop button is pressed I called Stop() on the Microphone to stop recording. Afterwards the MemoryStream is closed and we can now access the underlying buffer for playback.

A third button, you guess it “Play”, uses the SoundEffect class to play back the contents of the buffer. Into the constructor I pass the .ToArray() method of the MemoryStream, the SampleRate from the Microphone and AudioChannels.Mono since we know this is a mono source. You can then either call Play() or if you want to muck about with the sound you can use the overload which accepts volume, pitch and pan values. For example se.Play(0.7f, 0.5f, -1.0f) plays the sound at 70% volume, with pitch raised half an octave and through the left channel. Unless the user is wearing a stereo headset the panning will probably be lost on them. By playing with the pitch property (-1 – one octave lower through to +1 – one octave higher) you can probably find your perfect balance between Brian Blessed and Joe Pasquale…

As Rob Miles noted in his blog there seems to be an issue with pitch values > 0.6 in the current release.

#    |
# Tuesday, March 23, 2010

Windows Phone 7 – For Web Developers

The emulator for Windows Phone 7 includes Internet Explorer so you can test your websites now to see how they are rendered on this device. The emulator gives you a lifesize rendition of the device screen so you can format your pages appropriately. To customise your site for this new device you’ll need to identify it when it hits your server so here are the key facts:-

User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows Phone OS 7.0; Trident/3.1; IEMobile/7.0)

I’ve highlighted the items which indicate the platform and the browser. The browser also sends the UA-pixels header which describes the screen. On the emulator this is 480x800 (regardless of the screen orientation in use at the time) and it has been announced that there will also be devices using 320x480 (HVGA)

#    |
# Monday, March 22, 2010

Windows Phone 7 – Input

The Software Input Panel in Windows Phone 7 is entirely new. Unlike previous versions there will be a single SIP provider and device manufacturers will not be able to customise it. This means you can guarantee the same experience across different device types. With Windows Mobile there were some big differences between the input models of Standard Edition (Smartphone) and Professional Edition (Pocket PC) device types. We had the ability on Professional Edition devices to show or hide the sip and select from available input panels but no further control to customise the panel based on the input type required. For example to get a numerical keypad often required faking a screen press to “shift” the keyboard (unless your device had a specific keypad input panel).

Windows Phone 7 has a standard input panel but it does support different input contexts and will adjust accordingly. So if you mark a TextBox as requiring a Phone Number you’ll get a big numerical keypad. There are a number of different contexts supported, the UI guidelines document describes them but has some errors as the names do not match those you’ll see in Visual Studio and there are no examples of how to set them. I’ve tested a number of different InputScopeName values and have listed those below with a description of their behaviour (this effectively replaces the table on page 20 of the UI guidelines).

InputScopeName Layout
Default QWERTY
Text QWERTY with emoticons
EmailNameOrAddress QWERTY with .com and @ keys
TelephoneNumber 12-key phone pad
Url QWERTY with .com and “Go” enter key
Maps Not present
Search Same as Url – note this is not semi-transparent
SMS Address Not present – use TelephoneNumber

 

Along with these contexts there are others defined, most of which are the same or variations of the above. For example there are a number of numerical inputs such as CurrencyWithSymbol which has the QWERTY keyboard shifted to show numerals with common currency symbols (Dollar, Pound, Euro and Yen). All the ones I tried worked except for Xml which threw an unhandled exception. You can set the context easily in your XAML:-

Code Snippet
  1. <TextBox Height="31" HorizontalAlignment="Left" Margin="16,173,0,0" Name="textBox1" Text="TextBox" VerticalAlignment="Top" Width="449">
  2.     <TextBox.InputScope>
  3.         <InputScope>
  4.             <InputScope.Names>
  5.                                        <InputScopeName NameValue="EmailNameOrAddress"/>
  6.             </InputScope.Names>
  7.         </InputScope>
  8.     </TextBox.InputScope>
  9. </TextBox>
#    |
# Sunday, March 21, 2010

Windows Phone 7 – Theme Aware

Windows Phone 7 supports two basic themes each with four highlight colours. This gives the system eight possible colour-schemes. If you look at the templates supplied with the current CTP development tools you'll see that a selection of Colours and Brushes are hard-coded into your App.xaml. This means that even if you change the system theme your app will not follow suit. You may want to test how you application works with both Light (Black text on White background) and Dark (White text on Black background) themes so here is a little trick to help out.

First I am assuming you have an application based on the WindowsPhoneListApplication template (this should hold true for the other template). You need to make a couple of changes to the list template to remove hard-coded values:-

Code Snippet
  1. <ListBox.ItemTemplate>
  2.      <DataTemplate>
  3.          <StackPanel x:Name="DataTemplateStackPanel" Orientation="Horizontal">
  4.              <Border x:Name="DataTemplateBorder" Height="44" Width="44" BorderBrush="{StaticResource PhoneForegroundBrush}" BorderThickness="2.5" CornerRadius="100" Margin="10,16,0,0" VerticalAlignment="Top">
  5.                  <Path x:Name="DataTemplatePath" Height="16" Width="11" Fill="{StaticResource PhoneForegroundBrush}" Stretch="Fill" Margin="4,0,0,0" HorizontalAlignment="Center" VerticalAlignment="Center" UseLayoutRounding="False" Data="M337.59924,129.61948 L337.59924,141.51501 L345.5704,135.87381 z"/>
  6.              </Border>
  7.              <mpc:ListViewItem Layout="TextAndDetailsWithIcon" Text="{Binding LineOne}" Details="{Binding LineTwo}" Style="{StaticResource PhoneListBoxItemLayout}"/>
  8.          </StackPanel>
  9.      </DataTemplate>
  10.  </ListBox.ItemTemplate>

Here you can see we set the BorderBrush of the DataTemplateBorder and the Fill of the DataTemplatePath to the static resource rather than “White”. The simplest way to override the hard coded brush resources from a single location programmatically is to add the following lines in your App.xaml.cs file:-

Code Snippet
  1. SolidColorBrush pfb = (SolidColorBrush)this.Resources["PhoneForegroundBrush"];
  2.             pfb.Color = Colors.Black;

You can see here the only colour we have changed is foreground as the background seems to react to the system setting. Interestingly in the Dark theme the background is not black but a very dark grey, I haven’t found any explanation for this. Running the application now presents the application correctly using the Light theme, but of course the original Dark theme is broken because the text is now Black on Grey. Using knowledge of WPF I thought we should be able to use a member of the SystemColors class in System.Windows. However I quickly found that these are not implemented and all return RGB values equal to Black. There is also no system event to capture if the theme is changed. If we go to the Start menu while the application is running, access settings and change the Theme, when we return to our application it won’t have updated. Based on all the discussions of multi-tasking support I’m not sure if this scenario will be supported as it seems we will be expected to save state and exit when switching out to another application. This is not the case in the current CTP. At the moment it looks like we’ll just have to wait and see how this takes shape. Ideally the default templates will inherit the system theme with no need for extra coding so we only need to modify our app.xaml etc if we want to override the colours in our application. Some of the “hubs” which have been demonstrated use photographic backgrounds and I don’t think any of the released images show separate Light/Dark behaviour for them…

#    |
# Tuesday, March 16, 2010

Windows Phone 7 – For Mobile Developers

We have heard over the last couple of days how the Silverlight development model in Windows Phone 7 means that all developers are now mobile developers. However what does the platform offer beyond the standard Silverlight classes and functionality. Where possible I’ll try to compare this with the .NETCF Windows Mobile approach where applicable.

Location

Windows Phone 7 inherits the System.Device.Location namespace introduced in .NET 4.0. On a desktop machine this supports the new location API in Windows 7 (these classes are non-functional on older versions of Windows). This provides a single location API which can wrap the GPS, WiFi and cell-triangulation support of the phone. The API is incredibly simple to get started with and it is good to see that there is consistency with the full framework object-model. As a side note yesterday we released a new version of Mobile In The Hand (4.1) which adds InTheHand.Device.Location.dll. This exposes the exact same object model as .NET 4.0 and currently works on all devices which expose the GPS Intermediate Driver (Windows Mobile 5.0 and later and Windows Embedded CE 6.0).

Device Hardware

Windows Phone 7 devices must support a standard range of features which were previously optional, for example an Accelerometer. There is now a standard API to access this from your code in the Microsoft.Devices.Sensors.dll. There is no direct equivalent in the .NETCF world as previously these APIs if available were specific to the hardware vendor. There is a Codeplex project which attempts to provide a unified API over these device specific sensors and that goes beyond just the accelerometer. On the new Windows Phone documentation published to MSDN it looks like the sensor support will improve before release “A variety of sensors will return data that can be consumed by developers. For example, multi-touch input, accelerometer, and microphone sensors will all be accessible by APIs.”

For user feedback Windows Phone 7 devices include vibration, it appears that the device spec doesn’t allow for notification LEDs at all. The Microsoft.Devices.dll contains the VibrateController class which allows simple on/off control of vibration up to a maximum of 5 seconds at a time. There is no equivalent .NETCF functionality although it was possible to P/Invoke either the Vibrate or LED APIs depending on whether the device was Standard or Professional Edition. Mobile In The Hand has offered the InTheHand.WindowsMobile.Forms.Vibrate class for the past couple of versions and it has a similar object model. Your application cannot intercept or override the hardware buttons on the device which include power button, volume, camera and the standard three buttons on the front of the device (Back, Home and Search). You can reference the Xna assemblies from a Silverlight project in order to take advantage of Microphone input and SoundEffect output.

Tasks

There are very few hooks to allow your application to integrate with the built in applications. Windows Phone offers a number of tasks – reusable components which kick off specific actions on the phone. These are a bit like common dialogs in the traditional .NET world. Currently all that I have tried in the emulator fail with a COMException, however here is the list of these exposed from Microsoft.Phone.Tasks.dll

Class Name Windows Mobile Equivalent
BingMapsTask  
CameraCaptureTask Microsoft.WindowsMobile.Forms.CameraCaptureDialog
EmailAddressChooserTask Microsoft.WindowsMobile.Forms.ChooseContactDialog
EmailComposeTask Microsoft.WindowsMobile.PocketOutlook.MessagingApplication.DisplayComposeForm
MarketplaceLauncher  
MediaPlayerLauncher  
PhoneCallTask Microsoft.WindowsMobile.Telephony.Phone.Talk
PhoneNumberChooserTask Microsoft.WindowsMobile.Forms.ChooseContactDialog
PhotoChooserTask Microsoft.WindowsMobile.Forms.SelectPictureDialog
SaveEmailAddressTask  
SavePhoneNumberTask  
SearchTask  
SMSComposeTask Microsoft.WindowsMobile.PocketOutlook.MessagingApplication.DisplayComposeForm
WebBrowserTask  

 

Tiles

The old Home Screen and Today Screen models of Windows Mobile Standard and Professional editions are completely replaced. The new shell allows you to create tiles which effectively fill their place. These support not just a method to launch your application but also a method to show status updates (obvious examples are number of messages, missed phone calls etc). The current SDK doesn’t seem to expose this yet. There is a Microsoft.Phone.Shell.ShellEntryPoint class which the documentation indicates is used for this purpose but no details on its usage.

System Status

What appears to be missing entirely (at this point anyway) is some equivalent to the excellent State and Notifications Broker in Windows Mobile. That provides easy access to numerous system properties – Battery, Network connectivity etc with change notifications. There is a certain assumption with Silverlight applications that power is never an issue and you have permanent fast network connectivity (how else did you get to the website hosting a silverlight application). A well designed mobile application will have to behave well under a variety of conditions and perform a certain level of local caching of data rather than just being reliant on a web service to pull back live data. There is no System.Data namespace and no SQL CE database engine to program against so you will be responsible for serializing and deserializing your own data into isolated storage.

To Be Continued

Like most people I’ve only had a day or so to play around with the Windows Phone 7 tools and as noted above there are some gaps in the current CTP release. I’ll be adding more Windows Phone 7 posts over the next few months…

#    |
# Friday, March 05, 2010

Windows Phone Sessions at MIX Announced

The covers have been lifted off of the twelve sessions at MIX in the Windows Phone track. Following on from yesterdays announcements that Windows Phone 7 development consists of Silverlight and XNA, these session descriptions tell more about the entire development experience including the Marketplace:-

http://live.visitmix.com/Sessions#/tags/WindowsPhone

#    |
# Monday, February 15, 2010

Developing for Windows Phone 7

I've already had a couple of questions about how to develop applications for Windows Phone 7. At the moment the "developer story" has not been announced but over on the Windows Mobile Developer Blog they have announced that MIX10 will be where they discuss how to develop for Windows Phone 7:-

http://windowsteamblog.com/blogs/wmdev/archive/2010/02/15/windows-phone-7-series-going-big-for-developers-at-mix10.aspx

Attendees will have access to a dedicated Windows Phone track (currently the 12 sessions are unnamed) and access to the Windows Phone 7 developer tools:-

http://live.visitmix.com/News/Exclusive-Windows-Phone-7-Series-Offer-for-MIX10-Attendees-WP7

#    |