Pergunta

I may sound like a noob, but this problem is really not getting out of my mind, you should try it too.

whenever i add Microsoft.Phone.dll to a new project of Windows Phone 8.1 for the WebBrowserTask control, i get the following error.

And i have really no idea how to solve this.

http://2.bp.blogspot.com/-esfQ3c5cZ80/U2KBD5JRDyI/AAAAAAAAAiQ/HyorukOc_a4/s1600/Screenshot+(6).png

In previous versions (Windows Phone 8) it is fully functioning, but as we all know there are many changes in the WP8.1 SDK, therefore, i am not able to fix this issue.

Foi útil?

Solução

If you use Windows store apps project (WP8.1/Win8.1), WebBrowserTask class was replaced by Launcher class.

Now you must use LaunchUriAsync method from Launcher class

Some useful resources :

What's New in Windows Phone 8.1

Migrating your Windows Phone 8 app to a Windows Runtime XAML app

Outras dicas

private async void Button_Click(object sender, RoutedEventArgs e)
{
    string uriToLaunch = @"http://www.bing.com";
    var uri = new Uri(uriToLaunch);
    var success = await Windows.System.Launcher.LaunchUriAsync(uri);              
}

Don't forgot to use "async" keyword to Button_Click method

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top