Blog

  • APPA Mundi Tasks 1.9

    The latest version of our Tasks app has now hit Marketplace. This release builds on the improvements from my last blog post:-

    • We now have fixed an issue some users were encountering with synchronising Hotmail tasks in v1.8
    • We now support a wider range of Exchange Server 2003 mailboxes including those with non-standard security policies
    • Thanks to user-feedback we’ve improved the French and German text within the application
    • We’ve changed the timing of how the welcome message pops up in the trial version to avoid navigation issues
    • Based on user feedback we’ve added the option of putting undated tasks at the top or bottom of your To-Do list
    • Since version 1.7 we’ve changed the transition animations between pages to match the built-in applications (obviously this doesn’t come across in the screenshots!)

    We’d like to say thanks for all the great feedback we’ve received from users. We’ll keep listening and adding to the product so keep it coming!

  • 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.

  • Tasks: Coming in v1.7

    This week we released the second in a couple of updates to the Tasks application. We’ve added a large number of features and improved compatibility with a wider range of servers based on user feedback. Let’s look first at compatibility – we now support Exchange 2003 and other ActiveSync 2.5 compatible servers. This includes your Hotmail To-do list! We received feedback that a lot of users still had Exchange 2003, one of the main reasons for this is that this was the last Exchange version to support a 32-bit OS and many people have 32-bit Windows Server 2003 and Small Business Server 2003 machines which they have no immediate plan to replace.

    Trial Version

    The next common piece of feedback was in the functionality of the Trial version. we’ve removed the restriction on the number of Tasks which the application will sync. Because the app used to synchronise the first 10 tasks these were rarely the latest and most useful tasks to have on your phone. The trial app is now limited to run for 7 days to let you evaluate the application.

    New Features and Fixes

    We have improved the logic behind our live tile so that it’s updates should appear in a more timely manner. When it receives an update it also uses your chosen accent colour.

    We’ve made numerous tweaks to the user interface within the application too. We also respect your theme colour throughout the application, and have added some new transition animations between pages which closely match the experience in the built-in Email and Calendar applications which Tasks is designed to complement. We’ve made category editing easier by using a picker control to easily select existing categories as well as support for adding new categories.

    We’ve had support for editing Reminders on the phone in the last couple of versions but we’ve now added reminders within the application. When you launch the application it will display currently due reminders and others will pop up as they become due when you are using the application.

    We’ve added support for completing recurring tasks and the application will show both the completed instance and the next task in the pattern (if applicable).

    Thanks to feedback from several users we’ve also made improvements to the localised text – yes the application supports all Windows Phone languages (US English, UK English, French, German, Italian and Spanish).

    We’ve also made numerous bug fixes and some performance improvements. There were some issues around sorting, specifically where several tasks had blank subjects, these are now resolved.

    Exchange 2010 Synchronisation Fix

    One issue we have encountered can be observed if the app shows “initializing…” and then immediately “synchronization failed” when you try to sync. This seems to be specific to Exchange 2010 and can be resolved by removing the device from your Exchange account using Outlook Web Access and then resetting synchronisation.  From OWA click Options and “See all options…” then select Phone in the left-hand list. You’ll see a list of mobile devices attached to your account. Your Windows Phone will have an entry and the Tasks application will have a separate one. To find the correct device select one and click Details. You can identify Tasks because it will show the user-agent as APPA-Mundi-Tasks/x.x.x.x where x.x.x.x is the version number.

    Once you’ve identified the correct device delete it from the list, log out of OWA and from the Tasks application go to the Settings page and click Reset. The application can now setup a new sync relationship.

  • Windows Phone 7: Localisation and Windows Phone Features

    Anyone who has built an application for Windows Phone 7 in multiple languages will know there are three parts to the process. Within your application you can use managed RESX resource files to provide localised strings. For your application title or the initial text for your Live Tile you must use native resource dlls. Then when you are ready to submit your application to Marketplace you’ll need to provide descriptions, keywords and screenshots tailored for each supported language. At the moment there are six possible languages on the device side:-

    • English (United States)
    • English (United Kingdom)
    • French
    • German
    • Italian
    • Spanish

    On Marketplace there are five languages – English (International) is used to cover both variants above. Even if your icon is standard across all languages you still have to submit it with each language as you upload to Marketplace.

    There are several ways you can get your text translated, however one thing we noticed from experience is that certain features have established names in these different markets which may not equate to a direct translation from the English. Because the emulator and all retail Windows Phone 7 devices support all six languages you can easily change your device language and see how your application looks.

    Feature names

    For my future reference (and for yours) I’ve included a table below of some of these which may be useful. As I compile a list of more common words and commands I’ll add them to the table:-

    English French German Italian Spanish
    Start screen Écran Démarrer Startseite Start Screen Pantalla Inicio
    Live Tiles vignettes dynamiques Live-Kacheln riquadri animati ventanas vivas
    People Contacts Kontackte Contatti Contactos
    Pictures Photos Bilder Foto imagenes
    Games Jeux Spiele Giochi Juegos
    Marketplace Marketplace Marketplace Marketplace Marketplace
    Email E-mail E-Mail E-mail Correo electrónico

    Common Controls

    See also my previous post with localised resources for the Silverlight Toolkit which localises the Date/Time pickers and ToggleButton controls. This also works with the latest February release of the toolkit, simply use this destination folder:-

    C:Program Files (x86)Microsoft SDKsWindows Phonev7.0ToolkitFeb11Bin

    The exception which proves the rule

    Finally another observation which is specific to German. While the UI normally displays pivot headers and toolbar/menu text in lower-case this is not true for German where items should be capitalised.

  • Windows Phone 7: More Tilt Effect

    The Silverlight Toolkit for Windows Phone (Latest version is February 2011) contains a Tilt Effect implementation. To add it to your controls requires the addition of an XML namespace definition and one dependency propery set in your page XAML.

    <phone:PhoneApplicationPage

    …etc…
    xmlns:toolkit=”clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit”
    toolkit:TiltEffect.IsTiltEnabled=”True”>

     

    However the implementation doesn’t apply the effect to all the same places as you will find it in the native application. So far I’ve identified the ListPicker and MenuItems within the ContextMenu control. You can add additional types to receive the Tilt effect and I’ve raised an issue in the CodePlex project so hopefully this will be addressed in the next update. In the meantime you can add the following to your App constructor:-

    TiltEffect.TiltableItems.Add(typeof(ListPicker));
    TiltEffect.TiltableItems.Add(typeof(MenuItem));

    By itself I found that this didn’t actually fix the ContextMenu and the items do not tilt as they do in built in applications. However all is not lost! If you apply the property to each entry in your ContextMenu it does use the feature:-

    <toolkit:ContextMenuService.ContextMenu>
    <toolkit:ContextMenu>
    <toolkit:MenuItem toolkit:TiltEffect.IsTiltEnabled=”true” Name=”firstMenuItem” Header=”edit” Click=”FirstMenuItem_Click”/>
    <toolkit:MenuItem toolkit:TiltEffect.IsTiltEnabled=”true” Name=”secondMenuItem” Header=”delete” Click=”SecondMenuItem_Click” />
    </toolkit:ContextMenu>
    </toolkit:ContextMenuService.ContextMenu>

    Once you’ve done this you’ll have a context menu which behaves closer to the built in control. The Silverlight Toolkit is a great resource for additional controls and features which are not present in the Windows Phone 7 SDK. As always I’m eagerly awaiting the next update!

  • When Phone Tasks Might Not Work

    The range of Tasks available in the Microsoft.Phone.Tasks namespace call into various system features from your application. In some circumstances these may not work as expected. The most obvious example is the Emulator where not all of the system is implemented. The behaviour will differ depending on the specific task. For example EmailComposeTask on the emulator will display a message that no accounts are setup and of course you cant create these yourself because this functionality is hidden in the emulator. The other situation which can cause tasks to fail is when your device is docked with the Zune software. As a developer there is a tool to get around this when debugging but you must write your software to be aware of this to avoid upsetting users. In Windows Mobile we would have used SystemState.CradlePresent to detect when the device was docked, there isn’t an equivalent property for Windows Phone. Instead you can check the network type. Because we know that the hardware configurations for Windows Phone 7 are quite specific we know that devices will have phone, wifi and USB cable connections. You can detect the network type using the Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType property. There are a lot of possible values in the NetworkInterfaceType enumeration but only a few are relevant:-

    Ethernet – Used for Zune cable connection

    MobileBroadbandCdma

    MobileBroadbandGsm – For phone connections

    Wireless80211 – For WiFi

    So by checking for the value Ethernet we can tell if the device is currently docked. The only caveat is that this property isn’t set immediately when you dock and there can be a few seconds before the connection is established.

     

    Case Study – PhotoChooserTask

    The PhotoChooserTask works on the emulator with a selection of default images. On the phone it will fail if the phone is docked. The Completed event will be raised and a TaskResult of Cancel will be returned – as if the user had cancelled. This simple block of code can be used to wrap your call and handle this situation (for a change a little VB):-

    If Not Microsoft.Phone.Net.NetworkInformation.NetworkInterface.NetworkInterfaceType = Microsoft.Phone.Net.NetworkInformation.NetworkInterfaceType.Ethernet Then
                Dim pct As New Microsoft.Phone.Tasks.PhotoChooserTask
                AddHandler pct.Completed, AddressOf pct_completed
                pct.Show()
    Else
                MessageBox.Show("To view photos, disconnect your phone from the computer", "My Application", MessageBoxButton.OK)
    End If

     

    Task behaviours

    Task Name Emulator Phone (Docked)
    CameraCaptureTask Yes (simulated data) No (Completed returns TaskResult.Cancel)
    EmailAddressChooserTask Yes Yes
    EmailComposeTask Shows error message (no account) Yes
    MarketplaceDetailTask Exception 80070057 No
    MarketplaceHubTask Exception 80070057 No
    MarketplaceReviewTask Exception 80070057 No
    MarketplaceSearchTask Exception 80070057 No
    PhoneCallTask Yes Yes
    PhoneNumberChooserTask Yes Yes
    PhotoChooserTask Yes (Sample data) No (Completed returns TaskResult.Cancel)
    SaveEmailAddressTask Yes Yes
    SavePhoneNumberTask Yes Yes
    SearchTask Yes Yes
    SmsComposeTask Yes Yes
    WebBrowserTask Yes Yes

    The marketplace tasks perform no action and these ones don’t have a Completed event so you don’t get any feedback. You can provide similar logic to the above to warn the user that they can’t use Marketplace functionality when docked, you could also hide any marketplace links from your UI based on the network state.

  • Silverlight for Windows Phone Toolkit–Feb 2011

    The latest release of the Silverlight Toolkit contains a number of fixes and new features including:-

    TiltEffect (previously available separately)

    PerformanceProgressBar (previously available separately)

    Visual Basic Samples

    Major improvements to LongListSelector and Transitions

     

    Go grab the latest release here:-

    http://silverlight.codeplex.com/releases/view/60291

  • Copyable TextBlock for Windows Phone

    The latest update for Windows Phone 7 adds automatic support for Copy and Paste to TextBox controls in your application. By default this means you can’t copy text from static TexBlock controls. There is however a solution which requires minimal changes to implement. You have to replace the TextBlock control with a TextBox and set the IsReadOnly property to true. At first glance this will totally ruin the look of your application – even if you set custom background/foreground colours the control will display in grey on grey when IsReadOnly is true. It is possible to change this behaviour by applying a custom template to the control. Originally I did this in Blend but I found it had generated much more XAML than absolutely necessary so I set about removing redundant parts to result in this:-

    <ControlTemplate x:Key=”PhoneDisabledTextBoxTemplate” TargetType=”TextBox”>
                <ContentControl x:Name=”ContentElement” BorderThickness=”0″ HorizontalContentAlignment=”Stretch” Margin=”{StaticResource PhoneTextBoxInnerMargin}” Padding=”{TemplateBinding Padding}” VerticalContentAlignment=”Stretch”/>
    </ControlTemplate>

    Simply add this to the Resources collection for your page.

    Then your TextBox is customised like so:-

    <TextBox Grid.Row=”1″ Name=”TextBlockCopyable” IsReadOnly=”True” TextWrapping=”Wrap” Foreground=”{StaticResource PhoneForegroundBrush}” Template=”{StaticResource PhoneDisabledTextBoxTemplate}” Text=”We provide software solutions for a mobile world. We have unrivalled expertise in designing, developing and supporting mobile software for Windows Phone and Windows Embedded.” FontSize=”{StaticResource PhoneFontSizeMedium}” />
               

    The result looks and behaves like a TextBlock and still follows your system theme but allows copying on the latest emulator.

    I created a sample project with all of the code showing the different behaviours of the TextBlock, read-only TextBox and customised TextBox.

  • Tasks Frequently Asked Questions

    Since we have released a couple of updates for the application we have updated the Frequently Asked Questions for the Tasks application and moved them to a new location.

    If you have any issue with the application or question this should be your first port of call. If your issue is not described here please send us an email with as much detail describing the issue as possible and we will work with you to resolve it.

    Finally remember we do provide a Trial version of the application which lets you test whether the app works with your specific Exchange Server configuration.