# Tuesday, March 29, 2011

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!

#    |
# Sunday, March 27, 2011

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.

#    |
# Friday, February 18, 2011

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

#    |
# Tuesday, February 08, 2011

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:-

copyableTextBlockcopyableTextBlock2

I created a sample project with all of the code showing the different behaviours of the TextBlock, read-only TextBox and customised TextBox which you can download here:-

http://appamundi.com/files/uploads/CopyableTextBlock.zip (44kb)

#    |
# Tuesday, January 25, 2011

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:-

http://appamundi.com/tasks-faq/

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.

#    |
# Monday, January 24, 2011

Win a Windows Phone 7 LG E900

Following my review of the LG E900 handset we have the opportunity for one lucky winner to get a Windows Phone 7 of their own. All you need is a little creativity and this handset could be on its way to you! See the contest page for the full details:-

http://appamundi.com/win-a-windows-phone-7-lg-e900/

 

Good luck!

#    |
# Wednesday, January 19, 2011

Localised Resources for Silverlight Toolkit Nov 2010

Due to the absence of a built-in DatePicker control many are using the Silverlight Toolkit which has a Silverlight implementation to match the control used in the native applications. One limitation in the current release is that the UI is only available in English. The day/month names are retrieved based on the device locale but the page header and text labels for buttons are always in English. I had a look at the code to implement a fix, interestingly I found that the strings were already stored in resource files, it’s just that there were no resources for other languages. I’ve submitted a set of .resx files to cover all the currently supported Windows Phone 7 languages so hopefully my patch will be integrated in a future release. I’ve also discovered that by creating my own localised resource dlls from the latest source I can use them against the current release binary. We are sharing these files for other developers who use these controls and write multi-language software for Windows Phone. To use these simply copy the contents of the ZIP file into the install folder for the November 2010 toolkit on your machine which will be somewhere similar to “C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.0\Toolkit\Nov10\Bin”. As a bonus these resources also localise the On/Off text on the ToggleButton control.

If you’ve not attempted building a localised application before have a look at this article on MSDN - http://msdn.microsoft.com/en-us/library/ff637520(v=VS.92).aspx. Mostly this involves standard RESX editing but for Windows Phone you have to make a minor edit to your project file with a text editor, hopefully this can be fixed in a Visual Studio Patch/Service Pack.

Download AppaMundi.Phone.Controls.Toolkit.Nov10.Resources.zip

#    |
# Monday, January 17, 2011

LG E900 Review

I have had a fair bit experience with the test devices which were available prior to the release of Windows Phone 7 but this is my first experience with a commercial device. Therefore it seems inappropriate for me to try and compare this device with other hardware or even to look at the WP7 OS itself as I’m sure you are already familiar with the standard features. Instead I’ve looked at the hardware under real day-to-day usage and had a look at features which LG has added to the phone.

Hardware

The device measures 12.5cm tall by 6cm wide and is about 12mm thick. The hardware buttons and arrangement are pretty standard. The row of buttons below the screen for Back, Start and Search are very tactile and give good feedback in use rather than some devices where buttons are built into the glass of the screen. The Start button specifically is a raised Windows logo which makes it very easy to navigate by touch if for example you are worried about walking into a fountain while using it (http://www.youtube.com/watch?v=mg11glsBW4Y&feature=player_embedded).

The back cover is dark lacquered metal and the sides are plastic and are easy to grip. Connectivity is provided via a micro-USB port on the right-hand side and there is a headphone socket on the top of the device and a wired headset is included.

Screen

The screen is 3.8 inches, very bright and clear indoors and quite usable outdoors too. I’ve recently tried the Kindle reader application on the device and found it quite comfortable for a few short reading sessions.

Camera

The camera is marked as 5.0 mega-pixels. For a phone the results were quite good but don’t be under the impression that this is comparable with a similarly spec’d digital camera. I’ve found myself more inclined to use the camera for quick shots now that WP7 has a shortcut to launch the camera from a locked state using the hardware button. The device has a small mirror on the back to help you take a self-portrait if you so wish and an LED flash which can be turned on or off or used automatically. LG have implemented custom settings in the form of “Photo Smart Settings” accessible from the Camera app which allows you to change between a number of 4:3 or 16:9 widescreen resolutions and adjust the brightness and white balance settings. There is also a link to Panorama Shot which is a cool utility to help you stitch up to 5 images together into a panorama. It gives you a live overlay on the screen to show you where to position the camera for the next shot. The results were quite impressive and because you have the finished panorama on the phone you can upload it to Facebook or SkyDrive or send in an email using the Pictures hub.

Battery Life

I’m not a heavy user or Wi-Fi or cellular data most of the time, as such I found I only had to charge the phone every other day. Turning off Wi-Fi and Bluetooth most of the time keeps battery usage to a minimum. Perhaps I’m unnaturally frugal based on my experiences with other phones so your experience may differ.

LG Applications

The device ships with some LG specific applications. Tiles are installed on the Start screen for three of these – ScanSearch, PlayTo and Panorama Shot.

The app I was particularly interested in trying was PlayTo which allows you to output to a DLNA compliant screen. We have a TV with DLNA support but have never really taken advantage of it. When you first run the app it will search for a compatible device. It soon found our TV and connection worked. The TV may have additional settings or a process to ask for permission when you connect a new device. We then have the option of playing Music, Pictures or Videos. I tested a few tracks of music from my device. I have a mixture of MP3 and WMA files and I found the TV refused to play the WMA files but worked okay with MP3. The track name and album art were also transferred which I wasn’t expected and it looked impressive, you can use the controls on the phone to skip tracks as well. Photos worked well with a couple of galleries including photos taken on the device. You can browse a carousel of images on the device and select them to be sent to the TV. Videos were not so successful. First I tried playing a video clip captured on the device and it would not play. I suspect this is because the TV doesn’t support the codec used but it is a shame. I would assume that being able to show videos you have captured would be the main use for this functionality. I guess this is a limitation with DLNA devices at the moment.

ScanSearch is an augmented-reality application which searches for a number of categories of places in the local area (restaurants, banks etc) and overlays them on screen over the live camera view based upon the compass in the device. Personally I’d prefer to see results on a map but having the map turn as you turn the device would be quite clever. This is obviously an OEM specific feature as regular developers have no access to the compass and can only read the Course from the GPS data which will only be accurate when you are moving.

Alongside the pre-installed applications there is a special area within the Marketplace for LG specific applications. There they make available a number of other apps for free (often for a limited period) from system utilities to a golf caddy.

Issues Encountered

The device shipped was customised for Vodafone Germany and so it had some features specific to that network. Also it showed a feature that OEMs are able to add an additional accent colour which in the case of Vodafone is their corporate red.

Because the device was built for the German market the initial boot occurs in German but it can be changed to any of the other currently supported languages – English (US or UK), French, Italian and Spanish. I found that when set to English a number of third-party applications which support multiple languages in the Tile and Application Name were showing a name in German. I don’t know if this is an issue with Vodafone Germany’s customisations or something in WP7 itself…

Wi-Fi has been somewhat unreliable for me. When it connects it’s great but after a while it will fail to reconnect and only restarting the wireless hub and the device can get it to reconnect. I have seen this with other devices so I suspect it is my wireless hub rather than the phone which is to blame.

Conclusion

This has been a great day-to-day device, it has a good sized screen and is slim. I found the battery lasted long enough for my usage. I like the fact that devices are standardising on the micro-USB port so I can carry a few different devices and one USB charger. I found the intermittent Wi-Fi issues annoying but I suspect my wireless hub is at fault so will investigate changing it. The LG specific features such as PlayTo and Panorama Shot are valuable additions to the OS and well integrated.

#    |
# Monday, December 13, 2010

APPA Mundi Tasks 1.0 – Frequently Asked Questions

We’ve received a lot of great feedback for the Tasks application so I thought it would be useful to provide some frequently asked questions (and answers) here:-

How secure are my credentials, do you send them to your own server?

Your credentials are only used to communicate with your Exchange Server directly using the Exchange ActiveSync protocol just like your Email and Calendar applications. We don’t use any proxy servers or other mechanisms.

How do I know exactly what settings to enter?

You can look at the settings associated with your Outlook email account and enter them as they are displayed there. See this previous post for details - http://mobileworld.appamundi.com/blogs/peterfoot/archive/2010/12/12/appa-mundi-tasks-your-exchange-server.aspx

I’ve entered my settings the same as for my Email client, I can sync email but Tasks will not sync.

This will happen if your server uses a version prior to Exchange 2007. We don’t support servers older than Exchange 2007 due to the way the protocol is licensed. In our forthcoming v1.1 update we have added a specific error message to make this clearer if an older version is detected.

I used the trial successfully and purchased the full version and it only shows the small number of tasks I had with the trial and says synchronisation complete if I try and sync

When you upgrade the app should force a refresh of the sync relationship which will bring back the entire collection from the server. If this doesn’t happen you can manually force a refresh by tapping the Reset button on the Settings page

I used the full version and synchronised successfully and exited the app, now it won’t load again

We’ve seen this happen in a few cases and have prepared a v1.1 update to resolve this which will be available shortly.

I use a Vodafone Germany LG Optimus device set to English, the app shows as “Aufgaben” in the programs list

This appears to be a quirk with the specific device. The application itself runs in the correct language but the application name will show in German. For other languages on the same device (French, Spanish and Italian) the application name will appear as expected.

Sometimes I make changes to Tasks (e.g. Completed) or changes occur on synchronisation but the Active and Completed lists don’t update

This is a known issue and is resolved in the v1.1 release which should be available in Marketplace shortly

#    |
# Sunday, December 12, 2010

APPA Mundi Tasks–Your Exchange Server

Below are some hints for setting up the Tasks application to synchronise with your Exchange Server:-

 

Exchange Server Settings

We have no way to use your settings already entered when setting up your Exchange Email account so it is necessary to enter these again. In order to setup synchronisation you’ll need your Username, Password, Domain (optional) and Server name. You’ll also need to know whether your server synchs over HTTPS (usually it does). Because Exchange Email supports an auto discovery process you rarely have to enter these full settings when setting up your email. Because also there can be a redirection process the actual server name can differ from what you first enter based on your Outlook Web Access address. The easiest way to get direct to the required settings is to look at the settings for your Exchange email account once it has been fully setup on the phone.

1. From the Start screen tap the –> to go to the programs list

2. Select “Settings”

3. Select “email & accounts”

4. Select your Exchange account e.g. “Outlook”

5. Scroll down and take note of your settings

6. If your login uses a domain it will be of the form “domain\username”

7. Make a note of the Server value – this is the address to the ActiveSync server

8. Note the value of the “Server requires encrypted (SSL) connection” box

 

Exchange Server Version

It is possible to determine the version of the Exchange Server you synchronise with by logging into your Outlook Web Access site and going to the Options page. In the list of Options screens you’ll see a version number e.g. 8.3. 8 represents Exchange 2007 with the .3 indicating the Service Pack 3 release. Exchange 2010 is version 14. The app supports Exchange 2007 and later.

 

Gmail

Although Gmail can be used as an ActiveSync server and the web interface exposes a Tasks list this is not exposed through ActiveSync so if you try to use this account and synchronise you’ll receive an error that the mailbox contains no Tasks folder.

 

Hotmail Tasks

Hotmail Tasks are not supported.

#    |
# Saturday, November 27, 2010

32feet.NET User Guide now live on CodePlex

Today has been spent catching up on my To-Do list, though it still doesn’t look that way! I have however been able to make some progress with 32feet.

Alongside the class library documentation for the project there is a User Guide which provides an overview of the functionality and some example code snippets. Alan McFarlane created the documentation and it is an excellent starting point and Alan has continued to keep it up to date throughout each version of the library (currently up to 3.0 Beta). Up until now this has been distributed as a Word document with the install package but I have for some time been trying to integrate it into the Help file for the library. The help file is created with Sandcastle Help File Builder which supports adding in static content, but you have to provide the pages in Microsoft’s proprietary MAML format and I was never able to get the layout and appearance to look right and manually copying and pasting bits of documents was tedious. As a compromise I instead investigated the Documentation support on CodePlex. Each project hub is a Wiki and the mark-up required makes it very simple to put together the right structure and hyperlink between topics. Because all of the content is now part of the project Wiki it is also searchable – Type “Broadcom” into the search box and you can get straight to the relevant topics.

You can browse the User Guide at http://32feet.codeplex.com/documentation

I also recommend you follow Alan’s 32feet.NET blog where he has posted some of the excellent work he has been doing to add support for further Bluetooth stacks to the project.

#    |
# Friday, November 19, 2010

Navigation Stack on Windows Phone 7

While Windows Phone uses the same NavigationService and page-based model as “regular” Silverlight, one area the documentation doesn’t make clear is that although the APIs seem to support both Back and Forward navigation in reality there is no forward navigation on Windows Phone. This means when you navigate to a new page and then return Back to the previous page you can’t call NavigationService.GoForward() to return. CanGoForward will always return False. In the documentation for System.Windows.Controls.Frame (the base class of PhoneApplicationFrame) GoForward is described as:-

“Navigates to the most recent entry in the forward navigation history, or throws an exception if no entry exists in forward navigation. For Windows Phone this method will always throw an exception because there is no forward navigation stack.”

(my use of bold)

And yet in NavigationService:-

“Navigates to the most recent entry in the forward navigation history, or throws an exception if no entry exists in forward navigation.”

It makes perfect sense because there is no mechanism to browse forward on the phone unless you add buttons/menus onto your pages manually of course, but the documentation doesn’t spell out this difference from “regular” Silverlight very clearly.

#    |
# Wednesday, November 10, 2010

Marketplace for Emulator

The Windows Phone 7 Emulator takes a fairly bare-bones approach having only Internet Explorer available by default. Because it’s easier when presenting to use the Emulator than to try and capture a device screen with a camera it would be nice to show off features of the platform as part of your demonstration – not just your own apps. We put together a simple XAP package to install a Marketplace client onto the emulator, this allows you to demonstrate the Marketplace experience (with live data) and even show your clients how their apps appear within Marketplace. You cannot download apps to the emulator as it will not allow you to sign in with a Live ID – this is provided purely for demonstration purposes. You can read more about the tool and download from here:-

http://appamundi.com/Products/EmulatorMarketplace

#    |
# Wednesday, October 27, 2010

Windows Phone Tools Update

Microsoft have released an October update for the Windows Phone Development Tools. This release fixes gesture behaviour in the map control and adds two developer utilities – one to analyse your application to detect which capabilities it requires, the other to allow you to connect using your desktop without Zune running allowing you to use media features on the phone while debugging.

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=49b9d0c5-6597-4313-912a-f0cca9c7d277

#    |