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 ...
Get Windows® Phone 8 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.