WebBrowserTask for Windows Phone 8.1

99封情书 提交于 2020-01-15 08:06:49

问题


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.


回答1:


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




回答2:


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



来源:https://stackoverflow.com/questions/23412854/webbrowsertask-for-windows-phone-8-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!