Category Archives: Windows Phone

My views on Windows Phone 7 Series

I have mixed feelings about Windows Phone 7 Series. Whilst the new user interface is refreshingly different I’m not overly optimistic about its effectiveness. As more information about the new OS was made available I began to get a better idea of the target audience.

My current feeling is that Windows Phone 7 Series will become a solid offering for the mass consumer market. It will throw off the shackles of the Windows Mobile legacy and become a more stable, more consistent and vastly more appealing operating system for mobile devices. The only people that are likely to be disappointed by the new OS are the few die-hards that are currently running Windows Mobile 6.5 and below. The kind of people that wouldn’t be satisfied with an iPad when there are much more powerful and efficient means at hand. Those with such outlandish views that they believe touch interfaces (capacitive or otherwise) offer some amusement but just don’t cut it for serious tasks. People that believe copy/paste and multi-tasking are key operating system features. Alas I am once such person.

I think Windows Phone 7 Series has the potential to be very successful and I certainly hope that it is. For me a lot about having a phone is having a mobile device for which I can write applications. The ability to finally use Silverlight is something that I’m really excited about. So while the operating system itself is not something that I’m all that enthusiastic about the developer experience so far looks great.

Developing for Windows Mobile – XAML for Win Forms

Many years ago (2004/5?) I was given the task of writing a XAML engine for System.Windows.Forms. It was a great experience and to do the job properly (I hope) it took quite some time. It had support for most of what’s available in WPF’s XAML – namespaces, markup extensions, attached properites (IExtenderProviders in WinForms speak), type converters, late bound binding, styles, triggers etc. plus a bunch of stuff that isn’t – #include, using parameterized constructors, simplified referencing etc.

In my Windows Mobile UI Framework the idea of having the capability of defining screens in XAML was kind of an afterthought. I had truly forgotten how painful it is to define UI’s programmatically. I’ve also never been a fan of form designers – I think they are slow, in-accurate and generate hard to maintain code/XAML. To this day I do 90% of my XAML using an XML editor (VS or Kaxaml).

So as per my last post I whipped up a very simplified XAML parser/renderer to use with my Mobile UI Framework. However, the latest control that I added to the framework was FormHost which allows a System.Windows.Forms control to be hosted within a DrawingElement (my UI base class). Of course when I say “hosted” the FormHost is really just acting as a placeholder so that the hosted control can be positioned during the render pass.

Here’s the code I had to add for FormHost:

using System;
using System.Drawing;
using System.Windows.Forms;
using Spencen.Mobile.UI.Primitives;
namespace Spencen.Mobile.UI.Controls
public class FormHost : DrawingContainer
private Control _hostControl;
public FormHost( IDrawingHost host ) : base( host )
_hostControl = host as Control;
if ( _hostControl == null )
throw new ArgumentException(
"FormHost must have an IDrawingHost that is a Windows.Forms.Control.", "host");
// By default we have no background or border Background = new SolidBrush( Color.Transparent ); Stroke = null; } public Control HostedControl { get; set; } public override bool SupportsRotation { get { return false; } } protected override void OnRender( GraphicsContext context ) { base.OnRender( context ); var transformedBounds = TransformedBounds( context ); if ( !_hostControl.Controls.Contains( HostedControl ) ) _hostControl.Controls.Add( HostedControl ); var newLocation = new Point( transformedBounds.Left, transformedBounds.Top ); if ( newLocation != HostedControl.Location ) HostedControl.Location = newLocation; var newSize = new Size( transformedBounds.Width + 1, transformedBounds.Height + 1); if ( newSize != HostedControl.Size ) HostedControl.Size = newSize; } } }

So pretty simple – but what was extra nice was the fact that it meant I could immediately declare my hosted System.Windows.Forms controls using XAML without any changes to the XAML parser/renderer at all.

<?xml version="1.0" encoding="utf-8" ?>

<DrawingPanel x:Name="container" DesiredSize="Unbound" Background="{null}">
<TextElement Text="Text" DesiredSize="150,60" AutoSize="True"/> 
<RectangleElement DesiredSize="50,80"/>
    <EllipseElement DesiredSize="40,70"/>
<RegularPolygonElement NumberOfSides="6" DesiredSize="80,80"/>
<RegularPolygonElement NumberOfSides="3" DesiredSize="90,70"/>
<RegularPolygonElement NumberOfSides="8" DesiredSize="80,80"/> <Star NumberOfPoints="5" DesiredSize="80,80"/> <!-- Just to spice things up - here's some WinForms controls - just don't expect them to rotate! --> <FormHost DesiredSize="240,40"> <FormHost.HostedControl> <WinForms:TextBox Text="Hello WinForms" Multiline="True" BackColor="240,255,240"/> </FormHost.HostedControl> </FormHost> <FormHost DesiredSize="240,80"> <FormHost.HostedControl> <WinFormsanel> <WinFormsanel.Controls> <WinForms:RadioButton Checked="True" Text="Is WinForms?" BackColor="255,255,223"
Dock="Top" Height="20"
/> <WinForms:RadioButton Checked="True" Text="Is MobileUI?" BackColor="255,255,223"
/> </WinFormsanel.Controls> </WinFormsanel> </FormHost.HostedControl> </FormHost> </DrawingPanel> </View>

MobileUI_Screenshot 5

Windows Mobile 6.5 Update for HTC Touch Diamond 2 (SE Asia)

Tonight I downloaded and installed the official Windows Mobile 6.5 ROM (SE Asia) on my HTC Touch Diamond 2. I’d previously used Microsoft My Phone software to back up all my personal data (excluding SD card) to the cloud. The re-install process worked flawlessly putting ringtones, contacts, favourites, text message history etc. back just the way they were prior to flashing the ROM – very nice.

However, I’d like to see My Phone do more, specifically:

  • Backup/restore mail settings (most importantly POP)
  • Backup/restore bookmarks for Opera Browser (default on HTC device) – even if converted to IE8 favourites
  • Merge duplicate contacts – the option is there on the website – but it seems to just check for exact duplicates. I want it to merge details for entries that have the same name, e.g. contact listing with IM details, another with phone, yet another with email – merged into a single contact.
  • Less obnoxious advertisements on the website.

Developing for Windows Mobile – Mobile XAML?

I’ve now included a “first cut” XAML parser (ultra simplistic) within v0.2 of my Mobile UI Framework.

Allows me to convert:

<?xml version="1.0" encoding="utf-8" ?>
<GradientRectangleElement DesiredSize="Unbound" StartColor="240,240,240" EndColor="200,80,0"/>
<TextElement DesiredSize="400,500" Foreground="200,200,200" Text="Demo" Angle="315" AutoSize="True" 
HorizontalAlignment="Center" VerticalAlignment="Center"
/> <DrawingPanel DesiredSize="Unbound" Background="{null}"> <DrawingPanel.LayoutEngine> <StackLayout Margin="8,4" Padding="4"/> </DrawingPanel.LayoutEngine> <ButtonBar Text="Animations" SecondaryText="Animate properties of graph primitives"
DesiredSize="UnboundAxis, 80" Background="{null}"
/> <ButtonBar Text="Trasitions" SecondaryText="Optimized bitmap animations"
DesiredSize="UnboundAxis, 80" Background="{null}"
/> <ButtonBar Text="Primitives" SecondaryText="Polygon, Ellipse, Image, Text"
DesiredSize="UnboundAxis, 80" Background="{null}"
/> <ButtonBar Text="Behaviours" SecondaryText="Drag with slide"
DesiredSize="UnboundAxis, 80" Background="{null}" Command="{Binding DragDemoCommand}"
/> <ButtonBar Text="Layout" SecondaryText="Stack, Wrap and Radial"
DesiredSize="UnboundAxis, 80" Background="{null}" Command="{Binding LayoutDemoCommand}"
/> </DrawingPanel> </DrawingPanel>


I was getting really sick of doing it the “old fashioned way”

So far I support simple value type converters (float, bool), pen and brush converters, size and padding converters, resource naming (x:Name), complex properties (DrawingPanel.LayoutEngine) and loading types from other CLR namespaces via XML namespace (xmlns:sysDrawing).

Developing for Windows Mobile – Guru Meditation

I’ve been working away for a few nights now trying to put together a simple framework for building user interfaces on a Windows Mobile device. It’s only taken a few nights to build something that I’m pretty happy with… and I was thinking of maybe even posting some source code.

It was at this moment of course that I had a visit from my Inner Guru. You know the one… that little voice in your head that sniggers impolitely whenever you struggle to convert a loop into a LINQ expression. Or when you’re hacking out some prototype code and you need to new up an instance. You know that really its going to need an IOC container, you look around, no-ones watching… in goes the explicit “new Foo()”. Immediately your Inner Guru can be heard muttering to themselves, “tut… tut.. will he never learn…”.

Anyhow, my Inner Guru popped in for a visit just the other day and we had a quick chat about the work I’d been doing on my mobile framework. The conversation went something like this:

Me: Hey – check out this framework I’ve been building for Windows Mobile – pretty cool huh?

Guru: Hmm… yes it appears you’ve made quite some progress.

Me: Yeah – look it can do animations.

Guru: Very impressive. Did you have trouble using the DirectX libraries?

Me: Ah well, err no it’s just using GDI.

Guru: Ah, I see. Does that give you full hardware acceleration on the device?

Me: Um… no I don’t think so.

Guru: Ah, I see. Commendable that you have support for an opacity on each element.

Me: Yeah, well I mean no. It seemed like a good idea at the time but I haven’t done that yet.

Guru: Ah, I see. It appears all objects support using a RotateTransform?

Me: Yeah, well I mean no. I couldn’t figure out how to rotate images an arbitrary amount with decent performance.

Guru: Ah, I see. I notice that your transforms all inherit from a base class which of course must perform the Matrix calculations.

Me: Yeah, well actually no. I mean there is a base class but I haven’t bothered implementing the transforms using Matrix math – they’re just, you-know, hard coded.

Guru: Ah, I see. It seems you’ve done some work building the framework for a layout engine that can be plugged into any container control. Seems a bit WinForms’ish to me, not very WPF like.

Me: Well I didn’t think it was so bad, although I haven’t actually written that bit yet.

Guru: Ah, I see. So no actual layout panels yet, not even the most simple stack panel?

Me: Err, well no – but it wouldn’t be hard to add.

Guru: But you haven’t done it – even though it wouldn’t be hard.

Me: Well no.

Guru: Hmm.

Me: I was thinking of posting the source code.

Guru: I see. So despite the obvious architectural flaws, the missing classes, the lacklustre performance, the questionable code formatting you feel it adequate for public viewing, or perhaps that may be ridicule? I see you’re still using foreach loops – can’t quite seem to wrap your head around LINQ can you dear boy?

Me: Umm…

Fortunately it was at this point that my Inner Guru hit an untrapped exception deep in his runtime. The following image began blinking away in my head.

I suppressed an evil chuckle and posted the code:

Developing for Windows Mobile – Marketplace Sign-up (Part 2)

Contacted GeoTrust again and got an immediate verification over the phone. Was told that the Microsoft website would update the verified status within a few minutes. Several hours later… still waiting…

Decided to fill in the Payment section of the User Profile. Got to learning about banking Routing Numbers (not applicable within Australia) and banking Swift Codes. Have no idea whether the details are filled in correctly, but I’m guessing any income will be forwarded on to some lucky individual.

Tried asking the local Microsoft Mobile contact for some assistance. Took a week to reply and told me nothing. They do have a lovely web site though – no original content mind – but it is pretty.

Maybe its time to face that fact that Windows Mobile 6.5 is a “lipstick on a pig” release and I should just hold out for Silverlight on Windows Phone 7? At least by that stage (mid 2010?) I may have managed to complete the registration process…

Developing for Windows Mobile – Marketplace Sign-up

Windows Marketplace I’ve decided it would be fun and educational to launch a product through the soon to be released Windows Phone Marketplace. Obviously all the major phone/mobile OS vendors have already beaten Microsoft to market – so you would expect them to have taken some of the learnings from these ventures onboard. In other words – I expect them to do a good job of this – both from a customer and developer perspective.

The following is a summary of my experiences in getting an application into the Marketplace thus far…

Sign-up Process

Microsoft have been very crafty with their Marketplace registration process. Its obviously designed to weed out those individuals who are anything less that desperate to get their product into the app store. If you can answer “no” to two or more of the questions below then I suggest thinking twice before you consider signing-up.

  • Do you enjoy trawling IRS websites to learn about the various US tax forms?
  • Do you enjoy reading about country tax laws and specific treaty clauses?
  • Do you want to know the difference between SSNs and ITINs?
  • Do you have easy access to a non-expired passport else birth certificate plus other government photo id?
  • Do you enjoy filling out paperwork and posting (yes snail-mail) your documents overseas?
  • Do you mind taking a PDF signed by a Microsoft rep, on Microsoft letterhead, modifying it yourself and then sending it off to the IRS as an official sanction for an ITIN? [What is the point of this step?]
  • Are you really expecting to make a killer mobile app that will make this all worthwhile?

[Note: If you are a US taxpayer already then most of this will be irrelevant and the process will be a breeze.]

Of course I answered “no” to all of these but as I stated before I’m writing the whole thing off as an “educational experience”. Nothing worthwhile is meant to be easy… right?

[Note: There is actually a pretty good walkthrough/slideshow of the registration process here.]


If you got through the sign-up process don’t think you’ve beaten them. You now have to create your application icon/logo in a wide variety of resolutions (dpi) and sizes. Then you have to tweak the install process to pick out the right imagery for the particular device its being installed on. When I say tweak – I mean write some C code and inject that into the installer. OK – maybe that’s a little unfair – but go check out some of the following blog posts and their related comments.

As one tongue-in-cheek commenter put it:

“Was there some sort of requirement to do this in the most developer-hostile way possible, or was that just a happy accident?”

Getting Verified

During the sign-up process an email verification is sent out to you by the third-party identity verification company (GeoTrust) that are issuing the code-signing certificates. Make sure you respond to this email immediately because it takes a week or two after that for their poor over-worked web server to send out the next email which actually asks you to provide some credentials.

The good news is that you can supply these credentials back to them via email (unlike the IRS).

The bad news is that their systems are a little flaky and four days later they send your exactly the same email by mistake. Luckily their online chat staff seem to be a little more competent than their computer systems and will tell you to ignore the second email whilst they manually forward your details on to the next verification step.

I’m still waiting on a final outcome…

Submitting Your Application

This is the part of the process that I expected to be more challenging but unfortunately I haven’t gotten this far yet. Submitting your application to the Marketplace and have it pass all the internal testing. There are a number of tools that Microsoft have published which they use internally during the testing process. One such is Hopper – which jumps between your application and others – presumably to detect your applications ability to quickly switch (i.e. for incoming call), to use minimal resources particularly whilst switched out and to be stable over a long (2 hour) period.

One major gotcha with some of the test tools and those supplied with the Windows Mobile SDK is that they only work on 32 bit machines. This is annoying to say the least. They only 32 bit machine I have left is the new HP Netbook which my wife had grown rather fond of.

Well – assuming I every get past the verification process I may post some further thoughts on submission and publication.