Offline Maps: A new version (bugfix) and update of the base URL’s

I just posted release 1.4.1 of my OfflineMaps application.

There was an error in the 1.4.0 verszion which prohibited the downloading of tiles, which is what the application is all about.

I also noted that Google updated their base-URL’s, so if you download the above version, start by updating the base-URL’s.

You can download it on the project page

Hope you enjoy it !!

Offline Maps: Updated user interface and released version for Windows Mobile 6.0 – version 1.2.0

I’ve just released version 1.2.0 of the application.

The application allows you to download tiles served by google maps and openstreetmap to your harddrive and then view them offline, thus without an internet connection.

I’ve updated the user interface which is now much user-friendlier (I think)
There is also a preliminary version for Windows Mobile 6.0 with the offline server functionality and the routing and gps layers. It is however very slow but I’ve not tested it on an actual mobile device, only in the emulators provided by Microsoft.

You can get it at the Offline Maps page

Any remarks are always welcome.

Writing code for both the full .NET Framework and the .NET Compact Framework

Porting my Offline Maps application to the .NET Compact Framework, I was in for a big supprise:

I thought it would be simple: I intentionally seperated most of the GUI code from the Business code thinking that I would simply need to port the GUI and everything would be OK.

No sir, that didn’t work…

Problems encountered

The first supprise was that in Visual Studio 2005 you can not set a reference in a Device Application project to a normal .NET library. You must specify a special Class Library project specific to Windows Mobile (I’ ve been using the Windows Mobile 6 Professional SDK).

Secondly, not being used to programming for the .NET Compact Framework, I thought that having explicitly used mainstream classes, a simple recompile for the Compact Framework would suffise. However that didn’t work: apparently you can have equally named classes, but they don’t necessarily have the same methods. The Compact Framework mostly just supports a subset of the full Framework class methods.

Solutions

Looking for solutions I came across this article.
It offers a multitude of solutions from which I mostly used the “one folder, two projects” and “use partial classes”.

Another point to keep in mind is that if you have overloaded methods in a class with versions taking objects and versions taking the bare properties of those objects, sometimes the Compact Framework only supports those taking bare properties.

An example of this last case is a method which takes a rectangle as an argument opposed to a method taking an X and Y coordinate for the position and a Width and Height for the size of the rectangle.

Also, if some classes or methods aren’t supported that can lead to a whole area of functionality not being supported. An example of this are the StartCap, EndCap and LineJoin properties of a pen which are not supported in the Compact Framework. They can require you to implement a complete abstraction layer for your functionality. Fortunately I got a way with a partial class with two different implementations of a “CreateRoundedPen” method.

Something which surprised me the most is that some Environment static properties which after all are meant to enable cross platform development aren’t supported neither.

As an example the Compact Framework does not support the Environment.NewLine property. Weel, at least not in the version I used. I noticed in the Compact Framework 3.5 documentation that it is now supported.

Conclusion

So, cross device development from a single code base does take some preparation. It requires you to think about how to setup your projects folder structure and to read the documentation on classes and methods so to choose the method supported in both platforms.

But what experience, and derived from it tips, do you have?

Links

[1] Share Code: Write Code Once For Both Mobile And Desktop Apps
[2] MSDN documentation on the Environment.NewLine property