Windows Phone, Metro and anything else that's interesting

UrlEncode & HtmlEncode functions in WinRT

If your are looking the UrlEncode & HtmlEncode functions in WinRT or the HttpUtility namespace, you’ll find it no longer exists.
All helpers to encode/decode Url / Html are now available in the System.Net.WebUtility namespace.


Hope this helps !

WAWAG June 2013 – Codes and Slides

I presented at the Wales And West Application Group (WAWAG) on Wednesday 19th June 2013. My talk was titled “Lockscreen integration for Windows Phone and Windows”. You can find the code and slides for the talk here

How to: Create a Facebook style Lockscreen settings page

This article explains how to create a Facebook style lockscreen settings page for you app. (See Facebook Lockscreen) (more…)

How to: detect an app is running in Kids Corner

In this article I will be showing you how to detect an app is running in Kids Corner mode. Kids corner is one of the new features introduced with Windows Phone 8. It creates a section of the phone that has limited functionality (no access to messages, phone call etc) that’s safe for a child to play with unsupervised.

You might want to write apps/games that display different functionality based on the mode the phone is in. To do this we’ll make use of the ApplicationProfile class.

The ApplicationProfile class exposes a static property called “Modes” which returns the following values:

  1. Default – this is the default mode that Windows Phone applications run
  2. Alternative – this is the mode that Kids Corner runs under.

The ApplicationProfile class is defined under the “Windows.Phone.ApplicationModel” namespace.

Below is a snippet that overrides the “OnNavigatedTo” event for a page and  redirects to another page if the app is running under Kids Corner:

protected override void OnNavigatedTo(NavigationEventArgs e)
     switch (ApplicationProfile.Modes)
         case ApplicationProfileModes.Default:
          //do nothing

           case ApplicationProfileModes.Alternate:
             //running under kids corner so redirect
            NavigationService.Navigate(new Uri("/KidsMode.xaml", UriKind.Relative));





Meet Windows Phone 8 – Samsung ATIV S

With Windows Phone 8 coming out soon, I thought it might be an idea for a run-through of the new devices that will be available at launch. First up is the Samsung ATIV S

Samsung Activ S

Samsung Activ S

Samsung unveiled their first ever Windows Phone 8 handset, the ATIV S, at the IFA technology conference earlier this year in Berlin. The first thing you’ll notice is it’s similarities to the Galaxy SIII, which isn’t a bad thing at all. It’s a big, powerful but extremly thin phone, measuring in at 137x70x8.7mm. In comparison, the Galaxy S3 measures in at a slightly tweaked 131x71x8.6mm.

It’s a light phone too, weighing on 135g, which is impressive seeing as it’s also packing a 4.8in 720×1,280, 306ppi pixel density, super Amoled touchscreen display. The Ativ S boasts a 8MP rear-facing and 1.9MP front facing cameras. On the processor front, it’s packing a dual-core 1.5GHz Qualcomm MSM8960 Snapdragon processor and a large 2300mAh battery to boot.1.9MP front facing cameras. On the processor front, it’s packing a dual-core 1.5GHz Qualcomm MSM8960 Snapdragon processor and a large 2300mAh battery to boot.

On the connectivity front, the Ativ S comes with Bluetooth 3.0, USB 2.0, Wi-Fi 802.11 a/b/g/n, NFC and a 3.5mm earjack port.

Overall the Ativ S is a solid phone but it doesn’t have the WOW factor that some of the other Windows Phone 8 devices have.

Tips for submitting your Windows 8 app to the store

I’ve recently been submitting apps I’ve ported over from Windows Phone so I thought it would be interesting to post about tips for submitting your Windows 8 app to the store that will help speed your apps being accepted and published. (more…)

How To: Display a Message Box in Windows 8

This is an article on how to display a message box in Windows 8 using C#. The result will be something like the following screenshot:

Windows 8 Message Box Example

Here’s the code:

MessageDialog md = new MessageDialog("Here's the message", "Here's the title");
bool? result = null;
md.Commands.Add(new UICommand("Yes", new UICommandInvokedHandler((cmd) => result = true)));
md.Commands.Add(new UICommand("No", new UICommandInvokedHandler((cmd) => result = false)));

await md.ShowAsync();
if (result == true)
     // do whatever you need to for true
    // do whatever you need to for false

How to: Launch Internet Explorer from a Windows 8 Metro App

In this article I’m going to show you how to launch Internet Explorer from a Windows 8 Metro App and navigate to a specific website. The code is quite simple, use the Launcher class found in the Windows.System namespace. The LaunchUriAsync method takes a Uri parameter and supports async/await as well.

Opening a browser session

Uri pageUri = new Uri("http://www.bugail.com");

The Launcher.LaunchUriAsync method can also be used to open the compose email window with a few changes to uri.

Opening a compose email window string mailto = String.Format("mailto:?to={0}&subject={1}&body={2}", "support@bugail.com", "Test Subject", "TestBody"); var mailto = new Uri(mailto); await Windows.System.Launcher.LaunchUriAsync(mailto);

And that's it, a nice and easy way to launch a browser or compose an email from inside your application.

Cardiff WPUG – Introduction to MVVM

Yesterday I gave to talk to the Windows Phone User Group in Cardiff. The talk was an introduction to MVVM and it’s uses in cross platform development.

In my example, I used the MVVMLight framework written by Laurent Bugnion (website, twitter)  to create a Windows Phone application and then ported it over to Windows 8 with arouind 90% code reuse (give or take).

The slides and code example for this presentation can be found here

There was also a talk John Cooper from Nokia giving a talk on how to market and make money with your applications. His talk was totally unbiased and a refreshing look at how companies are pushing to help mobile developers on the Windows Phone platform.

Hello Cardiff WPUG