void OnScriptNotify(object sender, Windows.UI.Xaml.Controls.NotifyEventArgs e) { if (Element != null) { Element.InvokeEvent(WebViewEventType.JavascriptCallback, new JavascriptResponseDelegate(Element, e.Value)); } }
/// <summary> /// Called when window.script.notify has been called from JavaScript /// </summary> /// <param name="sender">sender object</param> /// <param name="args">event args</param> private void OnScriptNotify(object sender, Windows.UI.Xaml.Controls.NotifyEventArgs args) { Debug.WriteLine( string.Format( "ScriptNotify: {0}, CallingUri={1}, Value={2}", sender.ToString(), args.CallingUri, args.Value)); }
private async void Control_ScriptNotify(object sender, Windows.UI.Xaml.Controls.NotifyEventArgs e) { string result = e.Value; Debug.WriteLine("JavaScript function calling C# function. The result is => " + result); if (!result.Contains("appx://")) { await new Windows.UI.Popups.MessageDialog(result).ShowAsync(); } }
public async void WebView_ScriptNotify(object sender, Windows.UI.Xaml.Controls.NotifyEventArgs e) { if (e.Value.Contains("tap") && !IsOnStart && recordSettings.Touches) { if (currentRecordScreen == null) { currentRecordScreen = new RecordScreenModel(previousUrl, await DoCaptureWebView()); } float x; float y; string[] arr = e.Value.Split(new char[] { ':' }); if (!float.TryParse(arr[1], out x)) { System.Diagnostics.Debug.WriteLine("ErrorX"); } if (!float.TryParse(arr[2], out y)) { System.Diagnostics.Debug.WriteLine("ErrorY"); } int iX = (int)Math.Round(x); int iY = (int)Math.Round(y); HeatPoint hp = new HeatPoint(iX, iY); currentRecordScreen.ListPoints.Add(hp); if (!_webview.Source.AbsoluteUri.Equals(currentRecordScreen.UriPage)) { int indexFind = _screens.FindIndex(s => s.UriPage.Equals(currentRecordScreen.UriPage)); if (indexFind != -1) { _screens[indexFind].ListPoints = currentRecordScreen.ListPoints; } else { _screens.Add(currentRecordScreen); } indexFind = _screens.FindIndex(s => s.UriPage.Equals(_webview.Source.AbsoluteUri)); if (indexFind != -1) { currentRecordScreen = _screens[indexFind]; } else { currentRecordScreen = null; previousUrl = _webview.Source.AbsoluteUri; } } } }
/// <summary> /// Called when window.script.notify has been called from JavaScript /// </summary> /// <param name="sender">sender object</param> /// <param name="args">event args</param> private void OnScriptNotify(object sender, Windows.UI.Xaml.Controls.NotifyEventArgs args) { ////Debug.WriteLine($"ScriptNotify: {sender}, CallingUri={args.CallingUri}, Value={args.Value}"); string url = args.Value; // send event via public (but hidden from Intellisense) method Device.BeginInvokeOnMainThread(() => { this.Element.SendNavigating( new WebNavigatingEventArgs( WebNavigationEvent.NewPage, new UrlWebViewSource { Url = url }, url)); }); }
private void ScriptNotify(object sender, Windows.UI.Xaml.Controls.NotifyEventArgs e) { Element.MessageReceived(e.Value); }
private void Control_ScriptNotify(object sender, Windows.UI.Xaml.Controls.NotifyEventArgs e) { ContextBridge.BridgeEvaluator((BlazorWebView)Element, e.Value); }
private void CustomWebViewRender_ScriptNotify(object sender, Windows.UI.Xaml.Controls.NotifyEventArgs e) { _scriptNotifyResult = e.Value; }