Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/docker/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在通用windows应用程序中更新webview页面控件值_C#_Wpf_Windows 10 Universal - Fatal编程技术网

C# 如何在通用windows应用程序中更新webview页面控件值

C# 如何在通用windows应用程序中更新webview页面控件值,c#,wpf,windows-10-universal,C#,Wpf,Windows 10 Universal,我正在开发一个运行在Windows8.1和WindowsPhone8.1上的通用应用程序。在旧的基于Silverlight的Windows Phone应用程序中,我可以在WebView页面中插入javascript 我的Silverlight(windows 8.0)代码如下: Dispatcher.BeginInvoke(() => { Browser.InvokeScript("eval", "document.getElementById('lblLocation').inn

我正在开发一个运行在Windows8.1和WindowsPhone8.1上的通用应用程序。在旧的基于Silverlight的Windows Phone应用程序中,我可以在WebView页面中插入javascript

我的Silverlight(windows 8.0)代码如下:

Dispatcher.BeginInvoke(() =>
{
    Browser.InvokeScript("eval", "document.getElementById('lblLocation').innerHTML=['" + address + "']");
    Browser.InvokeScript("eval", "document.getElementById('ConsumerServiceAndPeriod_TimeOutLong').value='" + _longitute + "'");
});
现在我正在尝试创建具有相同功能的通用应用程序,如

private void doOperation(Coordinates objCoordinates)
{     
    var dispatcher = Windows.UI.Core.CoreWindow.GetForCurrentThread().Dispatcher;
    var ignored = dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
    {
        Browser.InvokeScript("eval", new string[] { "document.getElementById('lblLocation').innerHTML=['" + _address + "']" });
    });
}
执行之后,我犯了一个错误, 未实现该方法或操作


有人知道这个功能吗?

根据我的快速研究,Windows 8.1中似乎不推荐使用
InvokeScript
方法(请参阅中的备注,查看注释下的早期版本)。相反,您应该使用
InvokeScriptAsync


此外,您可能还想查看-it's HTML示例,谢谢您的快速回复。我得到了答案。var ignored=dispatcher.RunAsync(CoreDispatcherPriority.Normal,async()=>{Browser.InvokeScript(“eval”,新字符串[]{”document.getElementById('lblLocation')。innerHTML=[''+\u address+“]”});})