Here are the examples of the csharp api System.Action.Invoke(WebViewOptions) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
5 Examples
19
Source : BlazorOldEdgeWebView.cs
with Apache License 2.0
from jspuij
with Apache License 2.0
from jspuij
public void Initialize(Action<WebViewOptions> configure)
{
var options = new WebViewOptions();
configure.Invoke(options);
this.webview.Navigate("about:blank");
foreach (var (schemeName, handler) in options.SchemeHandlers)
{
this.uriToStreamResolver.AddSchemeHandler(schemeName, handler);
}
}
19
Source : BlazorWebView.cs
with Apache License 2.0
from jspuij
with Apache License 2.0
from jspuij
public void Initialize(Action<WebViewOptions> configure)
{
var options = new WebViewOptions();
configure.Invoke(options);
WebSettings webSettings = this.innerWebView.Settings;
webSettings.JavaScriptEnabled = true;
WebView.SetWebContentsDebuggingEnabled(true);
this.innerWebView.AddJavascriptInterface(new BlazorJavascriptInterface(this), "blazorwebviewinterop");
var resultCallBack = new ValueCallback<string>(s =>
{
// TODO: Handle javascript errors nicer.
if (!string.IsNullOrEmpty(s))
{
Console.WriteLine(s);
}
});
var blazorWebViewClient = new BlazorWebViewClient();
this.innerWebView.SetWebViewClient(blazorWebViewClient);
foreach (var (schemeName, handler) in options.SchemeHandlers)
{
blazorWebViewClient.AddCustomScheme(schemeName, handler);
}
}
19
Source : BlazorWebView.cs
with Apache License 2.0
from jspuij
with Apache License 2.0
from jspuij
public void Initialize(Action<WebViewOptions> configure)
{
var options = new WebViewOptions();
configure.Invoke(options);
var webConfig = new WKWebViewConfiguration();
webConfig.UserContentController = new WKUserContentController();
webConfig.UserContentController.AddUserScript(new WKUserScript((NSString)InitScriptSource, WKUserScriptInjectionTime.AtDoreplacedentStart, true));
webConfig.Preferences.SetValueForKey(NSNumber.FromBoolean(true), (NSString)"developerExtrasEnabled");
webConfig.UserContentController.AddScriptMessageHandler(this, "blazorwebviewinterop");
foreach (var (schemeName, handler) in options.SchemeHandlers)
{
this.AddCustomScheme(webConfig, schemeName, handler);
}
this.webView = new WKWebView(this.Frame, webConfig);
this.webView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
this.AddSubview(this.webView);
this.AutosizesSubviews = true;
}
19
Source : BlazorWebView.cs
with Apache License 2.0
from jspuij
with Apache License 2.0
from jspuij
public void Initialize(Action<WebViewOptions> configure)
{
var options = new WebViewOptions();
configure.Invoke(options);
var webConfig = new WKWebViewConfiguration();
webConfig.UserContentController = new WKUserContentController();
webConfig.UserContentController.AddUserScript(new WKUserScript((NSString)InitScriptSource, WKUserScriptInjectionTime.AtDoreplacedentStart, true));
webConfig.Preferences.SetValueForKey(NSNumber.FromBoolean(true), (NSString)"developerExtrasEnabled");
webConfig.UserContentController.AddScriptMessageHandler(this, "blazorwebviewinterop");
foreach (var (schemeName, handler) in options.SchemeHandlers)
{
this.AddCustomScheme(webConfig, schemeName, handler);
}
this.webView = new WKWebView(this.Frame, webConfig);
this.webView.AutoresizingMask = NSViewResizingMask.HeightSizable | NSViewResizingMask.WidthSizable;
this.AddSubview(this.webView);
this.AutoresizesSubviews = true;
}
19
Source : BlazorNewEdgeWebView.cs
with Apache License 2.0
from jspuij
with Apache License 2.0
from jspuij
public void Initialize(Action<WebViewOptions> configure)
{
var options = new WebViewOptions();
configure.Invoke(options);
foreach (var (schemeName, handler) in options.SchemeHandlers)
{
this.AddCustomScheme(schemeName, handler);
}
if (!BlazorWebViewNative_Initialize(this.blazorWebView))
{
throw new InvalidOperationException(this.lastErrorMessage);
}
}