2016-03-30 7 views
0

Windows 8.1で動作する汎用のアプリケーションで作業しています& Windows Phone 8.1。古いSilverlightベースのWindows Phoneアプリでは、WebViewページにJavaScriptを挿入することができました。ユニバーサルウィンドウアプリケーションでWebviewページのコントロール値を更新するには

マイシルバー(窓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 + "']" }); 
    }); 
} 

、 方法のように、同じ機能を持つユニバーサルアプリを作成しようとしていますまたは操作が実装されていません。

誰でもこの機能を認識できますか?

答えて

0

私の迅速な研究からInvokeScript方法は、Windows 8.1では推奨されませんようにそれは、(以前のバージョンためノートの下で見て、this api docで発言を参照)ようです。代わりにあなたがInvokeScriptAsync

を使用する必要があります。また、あなたはWin 10 Sample on WebViewをチェックアウトすることができます - それは、迅速な応答を

+0

おかげけれどもHTMLサンプルです。私はこれに答えました。 ( "eval"、新しい文字列[] {"document.getElementById( 'lblLocation')。innerHTML = ['" + _address + "']"}); }); } – Mahesh

関連する問題