Introducing Pontoon – A flexible bridge to the Universal Windows Platform

I first created the “Charming” libraries for Windows Phone in order to add some APIs which were added to Windows 8 but not available on phone. Many of the early ones replicated the “Charms” related functionality (Sharing/Search/Settings) hence the silly name.

When I created version 9 about a year ago I consolidated lots of separate libraries into just two – InTheHand and InTheHand.UI. The latter contained UI specific functionality such as MessageDialog, ToastNotification and ApplicationSettings. Following this I extended the library with support for iOS and Android using Xamarin and exposing the same UWP style API.

As I’ve been doing Xamarin development recently I’m constantly having to look for or write wrappers for native APIs to use across platforms. You sometimes find libraries which claim to provide a cross-platform API but actually only support iOS and Android. I looked at the large codebase I already had and thought about other areas which could be implemented across all the Windows and Xamarin platforms. Among the Windows platforms I added Win32 support so you can use these same APIs from Console, WinForms or WPF applications on versions prior to Windows 10. Since a lot of desktop apps still support Windows Vista and 7 this was very important to provide future code compatibility with Windows 10.

I’d toyed with changing the name before because it’s now irrelevant in an OS which no longer has the concept of Charms. I thought about the Windows 10 “bridges” – to take Desktop Apps, iOS and Silverlight to UWP and thought what I have here is effectively another bridge. It’s a flexible one though and it also works in both directions. You can code C# on numerous platforms and that code will be instantly portable to UWP. You can also use your UWP knowledge to easily target some of the more fiddly aspects of Xamarin platforms consistently. If you consider a Xamarin Forms application which might target iOS, Android and Windows once you step beyond laying out forms with the built in controls and basic page navigation there is no common API to work with Settings, Files, Geolocation, Network connectivity and more. If you are able to find a NuGet library which supports all the platforms you need you’ll have to learn a whole new API too. One word which kept springing to mind with the concept of a flexible bridge is Pontoon and so this is what I chose. Wikipedia says “A pontoon bridge, also known as a floating bridge, uses floats or shallow-draft boats to support a continuous deck for pedestrian and vehicle travel”. Although I renamed the GitHub repository this is a direct continuation of the Charming codebase but there will be a few breaking changes hence the new NuGet package and major version change.

If you are interesting in contributing to the library please do get in touch. There are a number of open issues which are still to be addressed and many more API areas which would make sense to implement in this way. I’ve consciously avoided most UI areas because this is something you’ll need to approach differently for each platform (unless you use Xamarin Forms) and I didn’t want introduce any additional dependencies. There are some UI elements such as StatusBar, MessageDialog, Toast/Badge notifications, CameraCaptureUI etc. I consider these to be part of the “Chrome” rather than your app UI – they will all have a very different look and feel depending on the platform but perform the same functions.

I’m still working on a sample application. I’ll probably use Xamarin Forms in order to create a simple UI to surface as much of this functionality as possible.

As always I welcome all constructive feedback – please use GitHub to raise any issues.

NuGet: https://www.nuget.org/packages/InTheHand.Pontoon/

GitHub: https://github.com/inthehand/Pontoon

Docs: http://inthehand.github.io/

 

Advertisements

Windows Marketplace for Mobile 6.x to be Discontinued

If you publish apps on the old Marketplace for Windows Mobile 6.x you should have received reminders that the service will be discontinued in two weeks. If you have been using our Mobile In The Hand product with a managed code app there are a couple of issues to be aware of. Our libraries contain the following two classes to provide programmatic access to the Marketplace client on Windows Mobile 6.x:-

  • InTheHand.Phone.Tasks.MarketplaceDetailTask
  • InTheHand.Phone.Tasks.MarketplaceLauncher

If these are called on a device with the Marketplace client installed they will launch the client application however once the service is discontinued no application details will be accessible so this may result in a confusing experience for your users. Consider these classes obsolete as they will no longer be supported and will be removed from the next release.

https://inthehand.uservoice.com/knowledgebase/articles/72785-windows-marketplace-for-mobile-6-x-to-be-discontin

Managing Processes and Memory With Mobile In The Hand 7.0

.NET Compact Framework

The Compact Framework provides the capability to start a separate process from your code, and stop it but it doesn’t give you more detailed information about what is running and what components are in use. Windows CE includes the optional ToolHelp component (present in all Windows Mobile versions). The InTheHand.Diagnostics namespace includes a number of classes for working with ToolHelp in a way which matches the full .NET Framework. The ProcessHelper class includes the GetProcesses() static method to return all running processes on the device. Extension methods GetModules() and GetThreads() return ProcessModule and ProcessThread collections for a specific Process.

ProcessModule exposes name, size and version information for an individual module. ProcessThread exposes id, priority and elapsed processor time.

Another way you might want to interrogate a process is to determine the memory usage. For your own process we’ve followed the Windows Phone model and so InTheHand.Phone.Info.DeviceExtendedProperties.ApplicationCurrentMemoryUsage

provides you this useful figure as a strongly-typed property. It is also accessible from the GetValue method as you would on Windows Phone.

Windows Phone

Other than the built in set of tasks you can’t start any other applications or tell if they are running. You do have access to memory statistics though which are accessible from the Microsoft.Phone.Info.DeviceExtendedProperties class. A limitation here is that if you use this method to get the memory statistics your app will automatically get marked as requiring the ID_CAP_IDENTITY_DEVICE capability which it doesn’t actually need for these properties. We built a helper class for two reasons – firstly to remove this requirement and secondly to provide strongly-typed properties as an alternative to the GetValue implementation. On Windows Phone therefore you can use:-

InTheHand.Phone.Info.DeviceExtendedProperties.ApplicationCurrentMemoryUsage

InTheHand.Phone.Info.DeviceExtendedProperties.ApplicationPeakMemoryUsage

and

InTheHand.Phone.Info.DeviceExtendedProperties.DeviceTotalMemory

Mobile In The Hand 7.0

Mobile In The Hand is a suite of components for developing mobile applications across Microsoft’s various mobile and embedded operating systems. It will save you development time and allow you to share more code across different .NET project types.

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.

070-580: Windows Mobile 6.5 Application Development

This may be a little late to the party but I thought I would share some information on this exam. Because you sign an NDA when you take the exam I cannot comment on specifics of the exam content, however I can offer some guidance on the study guide:-

http://www.microsoft.com/learning/en/us/exam.aspx?ID=70-580

This exam replaced the previous 070-540 exam which covered application development using Windows Mobile 5.0, .NET Compact Framework 2.0 and Visual Studio 2005. Therefore a large percentage of the material is the same between the two. The new topics come in the form of Widgets, LINQ, ADO.NET Sync Services and Windows Mobile Tools such as FakeGPS. The full list of skills measured can be read on the exam link above. There are a couple of oddities:–

  • The material is updated for .NETCF 3.5 by including LINQ but WCF is not listed.
  • ADO.NET Sync Services has never really been a core part of the development tools.
  • Finally one of the skills measured is creating a desktop installer for your application. There is not standard way of doing this but the guidance does exist (see list below) to put together a dll which acts as a custom install action within your desktop installer.

So once you’ve familiarised yourself with all the skills measured you’ll skip to the next tab on Preparation Materials and find there is nothing at all listed. Here is a list I think will help with your preparation:-

Microsoft Mobile Development Handbook – Microsoft Press. While the main book covers .NETCF 2.0 and Visual Studio 2005, the last chapter gives a run down on new features in Visual Studio 2008 and .NETCF 3.5 including LINQ. It ticks almost all of the Skills measured, there are a few articles which cover the new topics:-

Developing Widgets for Windows Mobile 6.5 – MSDN. The Windows Mobile 6.5.3 SDK added some support for Widget development to Visual Studio 2008 but I find it just hangs Visual Studio. This article shows the “old” approach from creating the HTML, JavaScript and building the ZIP file and renaming.

Programming Microsoft Synchronization Services for ADO.NET (Devices) – MSDN. Andy’s article describes Synchronization services from setting up and running synchronization through to optimisations for mobile use.

Using the FakeGPS Utility – MSDN.

 

The 70-580 exam is quite new and it is quite clear that if and when there is an exam created for Windows Phone 7 development it will by necessity be completely different. However for now 70-580 is the most up-to-date Microsoft exam for Mobility and is one of the requirements for the Mobility competency within the Microsoft Partner Program. Currently it doesn’t appear that there are any exams at all for Silverlight, but there are some coming in the next few months for .NET 4.0 and WPF.

Mobile In The Hand 4.2 Released

This latest update includes a number of performance enhancements and wider device compatibility.

A new SystemEvents class is added in the InTheHand.Win32 namespace which allows you to monitor power changes on devices which do not support the State and Notifications Broker (Pocket PC 2003 and all Windows CE devices).

InTheHand.Net.WebUtils provides a method to safely encode/decode strings in a HTML/XML friendly way.

InTheHand.WindowsMobile.Status.SystemState now supports more properties on Pocket PC 2003 and Windows CE devices by interfacing with lower level APIs on these devices.

This is a free update from v4.x. Registered users of v3.x can purchase a reduced price upgrade. Full product details here:-

http://inthehand.com/content/mobile.aspx