internal void AddInitializeScript(string script) { ApiInformationExtensions.ExecuteIfMethodPresent( WinRtType, "AddInitializeScript", 1, () => { _webViewControl?.AddInitializeScript(script); }); }
private void UnsubscribeEvents() { if (_webViewControl == null) { return; } _webViewControl.AcceleratorKeyPressed -= OnAcceleratorKeyPressed; _webViewControl.ContainsFullScreenElementChanged -= OnContainsFullScreenElementChanged; _webViewControl.ContentLoading -= OnContentLoading; _webViewControl.DOMContentLoaded -= OnDOMContentLoaded; _webViewControl.FrameContentLoading -= OnFrameContentLoading; _webViewControl.FrameDOMContentLoaded -= OnFrameDOMContentLoaded; _webViewControl.FrameNavigationCompleted -= OnFrameNavigationCompleted; _webViewControl.FrameNavigationStarting -= OnFrameNavigationStarting; _webViewControl.LongRunningScriptDetected -= OnLongRunningScriptDetected; _webViewControl.MoveFocusRequested -= OnMoveFocusRequested; _webViewControl.NavigationCompleted -= OnNavigationCompleted; _webViewControl.NavigationStarting -= OnNavigationStarting; _webViewControl.NewWindowRequested -= OnNewWindowRequested; _webViewControl.PermissionRequested -= OnPermissionRequested; _webViewControl.ScriptNotify -= OnOnScriptNotify; _webViewControl.UnsafeContentWarningDisplaying -= OnUnsafeContentWarningDisplaying; _webViewControl.UnsupportedUriSchemeIdentified -= OnUnsupportedUriSchemeIdentified; _webViewControl.UnviewableContentIdentified -= OnUnviewableContentIdentified; _webViewControl.WebResourceRequested -= OnWebResourceRequested; ApiInformationExtensions.ExecuteIfEventPresent( WinRtType, "GotFocus", () => { _webViewControl.GotFocus -= OnGotFocus; }); ApiInformationExtensions.ExecuteIfEventPresent( WinRtType, "LostFocus", () => { _webViewControl.LostFocus -= OnLostFocus; }); }
public static Windows.Web.UI.Interop.WebViewControlProcessOptions ToWinRtWebViewControlProcessOptions(WebViewControlProcessOptions options) { const string winRtType = "Windows.Web.UI.Interop.WebViewControlProcessOptions"; var retval = new Windows.Web.UI.Interop.WebViewControlProcessOptions(); if (!string.IsNullOrEmpty(options?.EnterpriseId) && !StringComparer.InvariantCulture.Equals(retval.EnterpriseId, options?.EnterpriseId)) { retval.EnterpriseId = options.EnterpriseId; } retval.PrivateNetworkClientServerCapability = (Windows.Web.UI.Interop.WebViewControlProcessCapabilityState)options?.PrivateNetworkClientServerCapability; ApiInformationExtensions.ExecuteIfPropertyPresent( winRtType, "Partition", () => { if (!string.IsNullOrEmpty(options?.Partition)) { retval.Partition = options.Partition; } }); ApiInformationExtensions.ExecuteIfPropertyPresent( winRtType, "UserAgent", () => { if (!string.IsNullOrEmpty(options?.UserAgent)) { retval.UserAgent = options.UserAgent; } }); return(retval); }