Tuesday 18 June 2013

Some lines may be missing printing to OneNote

In one of the applications I work on with my Peach Innovations hat on, we have recently discovered how useful it is to print directly to One Note for generating reports.

However we discovered today that pen’s created like this

HPEN hp = ExtCreatePen(PS_GEOMETRIC|PS_JOIN_BEVEL|PS_ENDCAP_FLAT, thickness, &lbr, 0, NULL);

with a thickness of zero don’t actually show up when sent to one note, although they show up on screen, and on every printer we’ve ever used, as well as printing to XPS.

I can’t find anywhere that documents that this shouldn’t work, but setting the pen to thickness 1 solves the issue.

Monday 17 June 2013

MouseMove Event - Why doesn’t my app work on WP8 (part 6 of N)

Continuing to port our app Where's my Tent to WP8, I ran into a problem with the rating control we built—It just wasn’t working correctly on WP8.

It turns out that on WP7, when you tap on a control, you also get a LeftMouseDown event, immediately followed by a MouseMove event.

This is no longer the case.  You no longer get the MouseMove event automatically, so must handle the position of the LeftMouseDown separately.

Sunday 16 June 2013

Wow, that’s a tall image–Why doesn’t my app work on WP8 (part 5 of N)

I’m getting ready to port our app Where's my Tent to WP8, and as a start, I thought I’d rebuild it with the latest libraries, and incorporate some changes from our other apps.

After hooking in the new code, I ran it on my WP8 device, and had a big surprise.

On WP7, it appears that photos returned from the CameraCaptureTask are always in Landscape mode, though you can figure out what orientation they really are in using a technique described by Tim Heuer.

Unfortunately for me, my app was coded to assume Landscape, so when an image is actually delivered in portrait mode, my assumptions break due to this breaking change.

If you’ve made the same assumption, you’ll have the same problem.

I suspect Tim’s code might not work either

Because now his code that rotates the image may now fail because it returns portait, and then he rotates the pixels.

Update 17 June 2013

It turns out that on WP8, the Exif data doesn’t exist at all in the stream returned by the Photo Chooser, so Tim’s code will crash, as it doesn’t check for an exception or null.

Saturday 8 June 2013

WebView Z Order Again–This time with AdControl

Back in October, when I was trying to get our Travel Advisories app release we ran across a problem with flyouts and z-order.

What happened was that when you popped open a flyout, our HTML views would appear on top of the flyout, as we’re working in XAML and not Javascript (Javascript have a flyout that works on the other hand, apparently)

It’s probably old news to some of you, but today we tried to add advertising to a Windows Store app, and came across the same problem.  The flyout has the advertisement floating on top of it.

I started with the samples Developer Walkthroughs (XAML) on the MSDN site, and sure enough my control suffered.  I was certain there had to be a solution, but as is typical for Windows development, it’s never easy to find it.

You end up on pages like this that fleetingly suggest UseStaticAnchor which is of course the actual solution, but the list of properties doesn’t even show it.

Other documentation around the web suggests Resume and Suspend which has now been superseded.

The moral of the story:  Set UseStaticAnchor=”True”  in your XAML.

What Microsoft Should Do

Maybe we’ll be lucky and in 8.1, they’ll get rid of this problem with the WebView Z Order.  I’m not holding my breath, and you probably shouldn’t either.

Storage Full on Windows Phone 7.8

I’ve been lucky enough to have received a fair few phones from Microsoft and Nokia for developing on the platform, and have passed them around my extended family.

I gave one of my Lumia 710 devices to my 86 year old father-in-law, who I’ve been slowly dragging into the modern age of computing over the past 25 years.  Don’t get me wrong: He worked at Ferranti working some of the earliest commercial computers, but things have changed a bit since the days of 1024x40 bits of core memory.

But you still run out of memory even today.  We found that something on the phone was using up all of the storage on the phone.  It got to the stage, where nothing was working, because no-one was able to update their isolated storage files. Worse, uninstalling apps one by one didn’t enlighten us.  There was still about 3gb unaccounted for.

In the end, we did a total reset of the phone, and then re-downloaded everything.  After that we had a reasonable amount of memory free, but I don’t have any confidence that we won’t be doing all of this again in the future.

It’s a shame that there isn’t more transparent access to the storage on being used on Windows Phone 7.x, so that users can find out which app is being a bad citizen and spoiling the Windows Phone party for everyone.

If a WP8 Lock Screen image changes…

and there’s no-one there to see it, did it really happen?

Our app, Terminator has been updated for Windows Phone 8, and now supports wide tiles, and can also be the lock screen provider.

However, we’ve noticed that if you don’t look at the lock screen every half an hour, occasionally, the image displayed is out of date, but if you download the images stored in isolated storage has been updated.

We believe this is caused by the A/B switching algorithm suggested on MSDN.

Let’s say it’s 9:00, and the first image runs, so we update image A
At 9:30, the run again, and generate image B.

This continues every half an hour, so when I go to bed at 23:00, when I get up and look at my screen at 6:00 I see the image generated at 23:00.

Looks like we need to find another algorithm, probably creating a new file based on clock ticks, and then deleting all of the old files, so we generate a new file each time.

Of course, we now have the problem that we may fill up the users phone with abandoned files if anything goes wrong, which is a subject I’ll discuss soon.