# Saturday, April 20, 2013

Use Team Foundation Service for Embedded Projects

Microsoft's hosted TFS (http://tfs.visualstudio.com/) provides a cloud hosted TFS project collection which is free for small teams. It works neatly with VS2012 which is fine for Windows Store and Windows Phone project types but for .NET Compact Framework development we are still stuck with using Visual Studio 2008. Luckily with a few patches it is possible to connect to a Team Foundation Service collection from Visual Studio 2008. I recently had to rebuild my Windows 8 desktop machine so for reference thought I would blog the instructions for setting this up. You'll need to install the items in the following order:-

No before you ask I didn't make up the name of that last one, I actually shortened it for you :-)

To open a project from the server open your shiny up-to-date VS2008 IDE and go to File > Source Control > Open from Source Control. You'll get a blank dialog with a drop down box for servers and an empty list of projects. Select the Servers... button and then click Add..

You'll notice that after these updates the dialog allows you to enter a fully formed Url for the server and will grey out the connection details below. You must specify https and include the DefaultCollection indicator, this Uri will always be of the form <yourchosenname>.visualstudio.com. When you click okay VS2008 will connect to the service and then prompt you to authenticate with your Microsoft ID. Once this is successful you'll see the following:-

 

It will show you the display name of the account you are logged in as at the bottom left (not on this shot) and a Sign Out option. Things get a little complicated if you regularly use different Microsoft IDs because you can get into a situation where VS2008 shows error messages from the service but doesn't show what account it thinks you are logged in as or give the option to log out and back in with different credentials. Still haven't found a neat way around this yet other than making sure you log out from your Microsoft ID in your browser and possibly also the browser within the VS shell. It seems to be a cookie issue and possibly compounded if you use a Windows 8 account signing in with your Microsoft ID. If you've successfully got to this step you can select a project, assign a local path and work as you would with a local TFS back end. As well as the source control the work items sync back and forth with the web front end. I don't think there is any capability to use the "Preview" build services for Embedded projects and doubt if this functionality will be added.

#    |
# Tuesday, April 16, 2013

Launching PDF Documents

In Windows Phone 8 the Windows.System.Launcher class allows you to open files with apps which are registered to handle them. On Windows Phone you have built in support for Office documents and audio and video formats. Lets say you want to open a PDF either remotely or downloaded by your app. There isn't a built-in PDF viewer but there are several available including free readers by both Microsoft and Adobe. If your user doesn't already have one installed there are some extra steps. The first thing that happens is that the user is prompted like so:-

If the user taps yes the phone will display a store search for apps which are associated with the file type:-

 

Not sure why Adobe Reader isn't in this list and why it looks like the last entry is a game :-) but at least the top couple of entries seem like they will do the job.

#    |
# Monday, April 15, 2013

Odd Issue With Camera Preview on Surface RT

When directly integrating video capture in your Windows Store app you can use the MediaCapture class. There are a number of methods which affect the video but not all will be supported on all devices. One of these is SetPreviewMirroring

http://msdn.microsoft.com/en-us/library/windows/apps/windows.media.capture.mediacapture.setpreviewmirroring.aspx?lc=1033

This mirrors the preview video so that your image is, well, like a mirror. However I've discovered that although the method throws an exception if not supported, it also throws an exception on Surface RT even though it is supported and the video is correctly mirrored. Worse still the GetPreviewMirroring method returns false when the video is currently mirrored :-(

#    |
# Saturday, April 13, 2013

Prototyping with Infragistics Indigo

I recently needed to create a prototype for a Windows Phone application and having recently discovered it I decided to use Indigo Studio to build it. The application is not particularly designed for Windows Phone however it has enough standard UI controls and customisations to make it easy to create phone mockups. They say a picture says a thousand words so why not have a look at a sample I created showing a few screens of an imaginary phone application.

http://indigo.infragistics.com/prototype/XX47K8P4

In posting that link I've just highlighted one of the great features - you can build a prototype and then share it (either on Infragistics servers or your own) via the web. The Silverlight magic then gives your clients a rich experience to understand the scope and user flow around the application. I intend to revisit this in a series of blog posts to discuss gotchas and tips for creating Windows Phone prototypes. Oh and one of the best features - it's free!

#    |
# Thursday, February 28, 2013

Working with .png Images

In my previous post I discovered a limitation with using the Share... extension point in the Photos app. The good news is that from within your own app you can open .png files. For this you can use the PhotoChooserTask which has been available since Windows Phone 7. This presents the user with essentially the same UI as the Photos app and you can browse the Screeshots folder and select those .png files. The Completed event returns you a PhotoResult containing the raw stream and the filename which you can use to open the file. Because .png access is available this way it seems an odd decision that it is not supported from the Photos app itself. The moral of the story - provide multiple methods for your user to select files...

#    |
# Tuesday, February 26, 2013

Photos Extra Share and .png

On Windows Phone 8 it is possible to register your app with the Share... extension point on the photo viewer. This allows your app to receive an image file and process it whether that is sending it to an online service or manipulating it on the device. I found recently an odd quirk with the feature. I setup the extension following the MSDN documentation. I wanted to test on my captured screenshots on the device so I went into the screenshots folder, selected an image and tapped share. While a range of system extensions were shown my custom app was not. I later discovered that it works in other albums. The reason as it turns out is that all screenshots are captured as .png files and camera images are .jpg and for whatever reason photo extras are not enabled for .png files. I searched online and there was a forum discussion but it is still awaiting a formal confirmation from Microsoft that this is expected behaviour.

http://social.msdn.microsoft.com/Forums/en-US/wpdevelop/thread/095a3300-111e-46d8-968a-3af1036504b7

#    |
# Wednesday, January 16, 2013

32feet.NET for Windows Phone

With the recent announcement of Windows Embedded Handheld 8 it seems fitting to discuss something related to industrial and line-of-business applications which you can develop now on the Windows Phone platform.

I've released the first drop of 32feet.NET for Windows Phone 8 to our CodePlex site and NuGet. Because the programming model on Windows Phone (based on Windows Runtime StreamSockets) this is a separate package and doesn't follow the programming model of the main 32feet.NET release. Windows Phone 8 supports Bluetooth programming out-of-the-box it is not straight-forward as it is build around the Windows Runtime Peer networking APIs but is different to the Windows 8 implementation. The aim of the 32feet library for Windows Phone is to simplify common tasks. This initial release adds the following features:-

  • Strongly typed extension methods for ConnectAsync which accept service Guids or numerical port numbers
  • BluetoothDevicePicker which offers an easy way for a user to select a device. Equivalent to the SelectBluetoothDeviceDialog in the core 32feet library.
  • Common Bluetooth service Guids
  • Bluetooth Barcode scanner sample. This sample app connects to a Motorola CS3070 scanner and allows input of Barcodes to the device screen. It should also work with other Bluetooth serial based scanners.

This is just a first release and we will be continuing to develop the library as well as add further localisation and samples. For example to demonstrate connecting to applications running on the desktop (Sorry not Windows Store apps currently). Your feedback is valuable so please visit the CodePlex project site to provide feedback.

There is a NuGet package available for the Windows Phone flavour of 32feet.NET to allow you to easily add it to your projects:-

http://nuget.org/packages/32feet.NET.Phone

#    |
# Wednesday, December 05, 2012

Persist Bluetooth Addresses on Windows Phone 8

The Bluetooth API on Windows Phone 8 is based around some customisations to the Proximity APIs which are part of the Windows API introduced with Windows 8. When you "discover" devices you can retrieve a collection of device identifiers for paired devices. The first time you perform a task you will want to use this mechanism to select the appropriate device. However you may want your app to remember a specific device and try to connect again on subsequent attempts. In the old .NET world with 32feet.NET we have a constructor for BluetoothAddress which allows you to supply the address in a variety of string or numeric forms. In the Windows API the Windows.Networking.HostName type is used to represent a host name whether it is for a Bluetooth device or an IP address. Normally the read-only Type property will indicate the type of the host.

In order to store a Bluetooth address for later use you should save the RawName property which for Bluetooth devices is in the form "(11:22:33:44:55:66)". The dotted hex notation is fairly common but notice the address is wrapped in brackets. Now to restore this address in a HostName instance you can later use to open a socket you can use:-

HostName storedHostName = new HostName(storedRawName);

You'll notice that this sets the host name and correctly sets the Type property to Bluetooth.

#    |
# Saturday, November 03, 2012

iCalendar Files on Windows Phone 8

iCalendar files are based on the set of data exchange specifications which also includes vCards. You may come across them either in emails or from a website. For example some sites which sell travel tickets allow you to download your itinerary in an iCalendar file. While Windows Phone has always supported vCards for contact information it doesn't recognise iCal files.

Since Windows Phone 8 introduced the ability to register for file associations this allowed me to use some old code I wrote back in the days of Pocket Outlook on Windows CE and Windows Mobile. My free iCalendar Import application has just become available in the Store for Windows Phone 8. You can download it from the link below. I'd welcome any feedback. There are some limitations on the supported event types - there is no way to insert recurring appointments into the user's calendar so this supports single events only.

http://www.windowsphone.com/s?appid=95287e45-05d7-4a63-aa82-619192cb1713

#    |
# Monday, October 15, 2012

WriteableBitmapEx for Windows Embedded Compact 7

I have ported René Schulte's excellent WriteableBitmapEx project to run on Windows Embedded Compact 7. The original library supports drawing across various XAML user interfaces - Silverlight, Windows Phone, WPF and Windows 8 Apps. Because XAML In The Hand exposes an object model which matches Silverlight there was very little work required to port, it just needed a new Dll project for .NETCF 3.5 and a reference to the XAML In The Hand DLL. This allows a whole range of complex drawing operations to be performed where using Silverlight Paths and Shapes would be inefficient.

WriteableBitmap for Windows Embedded

Performance will vary more because the range of hardware platforms available for Windows Embedded Compact varies considerably, both in processing power and screen sizes. I've tested the code on FreeScale development boards at up to 1024x768 and on the new Motorola WT41N1 Wearable Computer which has a small 320x240 resistive touch display with encouraging results. Writing XAML user interfaces for embedded devices is incredibly easy once you've experienced the Windows Phone and desktop tools. With built in support for touch and dynamic layouts and all the animation and data-binding you would expect it allows you to write fluid user interfaces for specialist devices where a consumer phone or tablet would be impractical. More information on XAML In The Hand is available here

 

#    |
# Monday, September 03, 2012

Connect Visual Studio 2008 to TFS2012 or Team Foundation Service Preview

Now that there is a new release of Team Foundation Server you may consider upgrading. However if you still work on projects for the .NET Compact Framework you'll still be using Visual Studio 2008. Luckily there is an update available to allow VS2008 to connect to a TFS2012 server or the new Team Foundation Service Preview (hosted TFS - why not check it out with a free preview account). You'll need VS2008 Service Pack 1 installed first (but you've got that already right!). The download and instructions are available here:-

http://support.microsoft.com/kb/2673642

#    |
# Thursday, May 03, 2012

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

#    |
# Monday, February 27, 2012

Windows Phone SDK 7.1.1

At MWC today Nokia announced the Lumia 610 which is a lower spec device designed for emerging markets. This is running an updated Windows Phone OS which supports devices with just 256MB of RAM. To enable developers to create apps which support the new lower memory devices Microsoft are releasing an update to the Windows Phone SDK - 7.1.1.

At the moment a CTP has been released so that you can test your applications on a 256MB emulator but you should not install this to your main development machine as it doesn't have a Go-Live license. To try out the new SDK you can download the CTP here:-

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=28962

There is just one API addition to support this change which is an additional property available from Microsoft.Phone.Info.DeviceExtendedProperties.GetValue - "ApplicationWorkingSetLimit" which will let you know whether you are running on a device with 256MB RAM. If your app/game is sufficiently resource heavy that you don't feel it will run on such a device you can opt out so that your app/game will not be available on these lower powered devices. This is done by adding the Requirements element to your WMAppManifest.xml:-

<Requirements>
      <Requirement Name="ID_REQ_MEMORY_90" />
</Requirements>

The other main difference for these devices is there is no support for Background tasks - either Periodic or ResourceIntensive and attempting to add a background task on one of these devices will throw an InvalidOperationException - so it's important to to check the capabilities first. Because of this limitation you need to design your app such that it doesn't rely on a background task and that whatever sync/processing the task normally performs can be done when the app is running in the foreground.

Microsoft have prepared some information on optimising apps for 256MB and it is available here:-

http://msdn.microsoft.com/en-us/library/hh855081(v=vs.92).aspx

Some of the suggestions including using the built in launchers and choosers rather than running functionality such as the WebBrowser control or Bing Maps control within your app. They also suggest avoiding using the page transitions provided by the Silverlight Toolkit but don't suggest an alternative - not sure if this means these devices don't have the smooth page transitions at all or if they are suggesting that doing them from managed code is too resource intensive. You may decide to implement multiple approaches and use different methods depending on the device capabilities. Obviously the trick here is the balance between providing the best possible experience on each platform and avoiding adding too much more code to maintain.

#    |
# Thursday, February 23, 2012

Tasks v1.19

The latest update to Tasks is now available in the Marketplace. This release continues the improvements to the sync experience by providing more resilience in situations where the network drops out during a sync. It also improves the reminders feature in Windows 7.5 and improves the display of reminders for tasks with very long titles.

http://www.windowsphone.com/en-GB/apps/55fcf880-6b03-e011-9264-00237de2db9e

 

#    |