O'Reilly logo

Windows® Phone 8 Unleashed by Daniel Vaughan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Launching a Protocol URI

Any app may request that the OS launch a protocol URI. This is achieved using the Windows.System.Launcher class.

The following excerpt from the MainPageViewModel constructs a URI by appending the protocol name with a custom message. The Launcher’s LaunchFileAsync method is then called like so:

void LaunchProtocol(){    Launcher.LaunchUriAsync(new Uri("unleashed:" + protocolMessage));}

The viewmodel contains a string property named ProtocolMessage, which allows the user to compose a message to be sent to a registered app for the protocol.

The view contains a TextBox that is bound to the ProtocolMessage property as shown:

<TextBox Text="{Binding ProtocolMessage ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required