public static extern global::System.IntPtr WebView_DownCast(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_LoadUrl")]
- public static extern void WebView_LoadUrl(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_URL_get")]
+ public static extern int WebView_Property_URL_get();
+
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_CACHE_MODEL_get")]
+ public static extern int WebView_Property_CACHE_MODEL_get();
+
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_COOKIE_ACCEPT_POLICY_get")]
+ public static extern int WebView_Property_COOKIE_ACCEPT_POLICY_get();
+
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_USER_AGENT_get")]
+ public static extern int WebView_Property_USER_AGENT_get();
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_ENABLE_JAVASCRIPT_get")]
+ public static extern int WebView_Property_ENABLE_JAVASCRIPT_get();
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GetUrl")]
- public static extern string WebView_GetUrl(global::System.Runtime.InteropServices.HandleRef jarg1);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_LOAD_IMAGES_AUTOMATICALLY_get")]
+ public static extern int WebView_Property_LOAD_IMAGES_AUTOMATICALLY_get();
+
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_DEFAULT_TEXT_ENCODING_NAME_get")]
+ public static extern int WebView_Property_DEFAULT_TEXT_ENCODING_NAME_get();
+
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Property_DEFAULT_FONT_SIZE_get")]
+ public static extern int WebView_Property_DEFAULT_FONT_SIZE_get();
+
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_LoadUrl")]
+ public static extern void WebView_LoadUrl(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_LoadHTMLString")]
public static extern void WebView_StopLoading(global::System.Runtime.InteropServices.HandleRef jarg1);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Suspend")]
+ public static extern void WebView_Suspend(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_Resume")]
+ public static extern void WebView_Resume(global::System.Runtime.InteropServices.HandleRef jarg1);
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_GoBack")]
public static extern void WebView_GoBack(global::System.Runtime.InteropServices.HandleRef jarg1);
public static extern bool WebView_CanGoBack(global::System.Runtime.InteropServices.HandleRef jarg1);
-
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_CanGoForward")]
public static extern bool WebView_CanGoForward(global::System.Runtime.InteropServices.HandleRef jarg1);
-
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_EvaluateJavaScript")]
- public static extern void WebView_EvaluateJavaScript(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2);
-
+ public static extern void WebView_EvaluateJavaScript(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3);
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_AddJavaScriptMessageHandler")]
public static extern void WebView_AddJavaScriptMessageHandler(global::System.Runtime.InteropServices.HandleRef jarg1, string jarg2, global::System.Runtime.InteropServices.HandleRef jarg3);
-
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_ClearHistory")]
public static extern void WebView_ClearHistory(global::System.Runtime.InteropServices.HandleRef jarg1);
-
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_ClearCache")]
public static extern void WebView_ClearCache(global::System.Runtime.InteropServices.HandleRef jarg1);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_ClearCookies")]
+ public static extern void WebView_ClearCookies(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebView_SWIGUpcast")]
public static extern global::System.IntPtr WebView_SWIGUpcast(global::System.IntPtr jarg1);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewSignalProxy_PageLoadStarted")]
- public static extern global::System.IntPtr new_WebViewSignalProxy_PageLoadStarted(global::System.Runtime.InteropServices.HandleRef jarg1);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewPageLoadSignal_PageLoadStarted")]
+ public static extern global::System.IntPtr new_WebViewPageLoadSignal_PageLoadStarted(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewPageLoadSignal_PageLoadFinished")]
+ public static extern global::System.IntPtr new_WebViewPageLoadSignal_PageLoadFinished(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewPageLoadSignal")]
+ public static extern void delete_WebViewPageLoadSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewPageLoadSignal_Connect")]
+ public static extern void WebViewPageLoadSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewPageLoadSignal_Disconnect")]
+ public static extern void WebViewPageLoadSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewSignalProxy_PageLoadFinished")]
- public static extern global::System.IntPtr new_WebViewSignalProxy_PageLoadFinished(global::System.Runtime.InteropServices.HandleRef jarg1);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_WebViewPageLoadErrorSignal_PageLoadError")]
+ public static extern global::System.IntPtr new_WebViewPageLoadErrorSignal_PageLoadError(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewSignalProxy")]
- public static extern void delete_WebViewSignalProxy(global::System.Runtime.InteropServices.HandleRef jarg1);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_WebViewPageLoadErrorSignal")]
+ public static extern void delete_WebViewPageLoadErrorSignal(global::System.Runtime.InteropServices.HandleRef jarg1);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewSignalProxy_Connect")]
- public static extern void WebViewSignalProxy_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewPageLoadErrorSignal_Connect")]
+ public static extern void WebViewPageLoadErrorSignal_Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
- [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewSignalProxy_Disconnect")]
- public static extern void WebViewSignalProxy_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_WebViewPageLoadErrorSignal_Disconnect")]
+ public static extern void WebViewPageLoadErrorSignal_Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2);
}
}
using System.Collections.Generic;
using System.Runtime.InteropServices;
using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
namespace Tizen.NUI
{
public class WebView : View
{
private global::System.Runtime.InteropServices.HandleRef swigCPtr;
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void WebViewPageLoadCallbackDelegate(IntPtr data, string pageUrl);
+
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ private delegate void WebViewPageLoadErrorCallbackDelegate(IntPtr data, string pageUrl, int errorCode);
+
+ private readonly WebViewPageLoadSignal pageLoadStartedSignal;
+ private EventHandler<WebViewPageLoadEventArgs> pageLoadStartedEventHandler;
+ private WebViewPageLoadCallbackDelegate pageLoadStartedCallback;
+
+ private readonly WebViewPageLoadSignal pageLoadFinishedSignal;
+ private EventHandler<WebViewPageLoadEventArgs> pageLoadFinishedEventHandler;
+ private WebViewPageLoadCallbackDelegate pageLoadFinishedCallback;
+
+ private readonly WebViewPageLoadErrorSignal pageLoadErrorSignal;
+ private EventHandler<WebViewPageLoadErrorEventArgs> pageLoadErrorEventHandler;
+ private WebViewPageLoadErrorCallbackDelegate pageLoadErrorCallback;
+
internal WebView(global::System.IntPtr cPtr, bool cMemoryOwn) : base(Interop.WebView.WebView_SWIGUpcast(cPtr), cMemoryOwn)
{
swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
- InitializeSignals();
+ pageLoadStartedSignal = new WebViewPageLoadSignal(Interop.WebView.new_WebViewPageLoadSignal_PageLoadStarted(swigCPtr));
+ pageLoadFinishedSignal = new WebViewPageLoadSignal(Interop.WebView.new_WebViewPageLoadSignal_PageLoadFinished(swigCPtr));
+ pageLoadErrorSignal = new WebViewPageLoadErrorSignal(Interop.WebView.new_WebViewPageLoadErrorSignal_PageLoadError(swigCPtr));
}
- private global::System.Runtime.InteropServices.HandleRef pageLoadStartedSignalProxy;
- private global::System.Runtime.InteropServices.HandleRef pageLoadFinishedSignalProxy;
- private void InitializeSignals()
+ internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebView obj)
{
- pageLoadStartedSignalProxy = new global::System.Runtime.InteropServices.HandleRef(this, Interop.WebView.new_WebViewSignalProxy_PageLoadStarted(swigCPtr));
- pageLoadFinishedSignalProxy = new global::System.Runtime.InteropServices.HandleRef(this, Interop.WebView.new_WebViewSignalProxy_PageLoadFinished(swigCPtr));
+ return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
}
- internal static global::System.Runtime.InteropServices.HandleRef getCPtr(WebView obj)
+ internal WebView Assign(WebView webView)
{
- return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
+ WebView ret = new WebView(Interop.WebView.WebView_Assign(swigCPtr, WebView.getCPtr(webView)), false);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
}
+ internal static WebView DownCast(BaseHandle handle)
+ {
+ WebView ret = new WebView(Interop.WebView.WebView_DownCast(BaseHandle.getCPtr(handle)), true);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return ret;
+ }
/// <summary>
- /// To make Button instance be disposed.
+ /// Dispose for IDisposable pattern
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void Dispose(DisposeTypes type)
//Called by User
//Release your own managed resources here.
//You should release all of your own disposable objects here.
-
+ pageLoadStartedSignal.Dispose();
+ pageLoadFinishedSignal.Dispose();
+ pageLoadErrorSignal.Dispose();
}
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
- DisposeSignals();
-
if (swigCPtr.Handle != global::System.IntPtr.Zero)
{
if (swigCMemOwn)
base.Dispose(type);
}
- private void DisposeSignals()
+ private void OnPageLoadStarted(IntPtr data, string pageUrl)
{
- if (pageLoadStartedSignalProxy.Handle != global::System.IntPtr.Zero)
+ WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
+
+ e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
+ e.PageUrl = pageUrl;
+
+ if (pageLoadStartedEventHandler != null)
{
- if (pageLoadStartedCallback != null)
- {
- WebViewProxyDisconnect(pageLoadStartedSignalProxy, pageLoadStartedCallback);
- }
- Interop.WebView.delete_WebViewSignalProxy(pageLoadStartedSignalProxy);
- pageLoadStartedSignalProxy = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ pageLoadStartedEventHandler(this, e);
}
+ }
+
+ private void OnPageLoadFinished(IntPtr data, string pageUrl)
+ {
+ WebViewPageLoadEventArgs e = new WebViewPageLoadEventArgs();
- if (pageLoadFinishedSignalProxy.Handle != global::System.IntPtr.Zero)
+ e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
+ e.PageUrl = pageUrl;
+
+ if (pageLoadFinishedEventHandler != null)
{
- if (pageLoadFinishedCallback != null)
- {
- WebViewProxyDisconnect(pageLoadFinishedSignalProxy, pageLoadFinishedCallback);
- }
- Interop.WebView.delete_WebViewSignalProxy(pageLoadFinishedSignalProxy);
- pageLoadFinishedSignalProxy = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
+ pageLoadFinishedEventHandler(this, e);
+ }
+ }
+
+ private void OnPageLoadError(IntPtr data, string pageUrl, int errorCode)
+ {
+ WebViewPageLoadErrorEventArgs e = new WebViewPageLoadErrorEventArgs();
+
+ e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
+ e.PageUrl = pageUrl;
+ e.ErrorCode = (WebViewPageLoadErrorEventArgs.LoadErrorCode)errorCode;
+
+ if (pageLoadErrorEventHandler != null)
+ {
+ pageLoadErrorEventHandler(this, e);
}
}
+ internal static new class Property
+ {
+ internal static readonly int URL = Interop.WebView.WebView_Property_URL_get();
+ internal static readonly int CACHE_MODEL = Interop.WebView.WebView_Property_CACHE_MODEL_get();
+ internal static readonly int COOKIE_ACCEPT_POLICY = Interop.WebView.WebView_Property_COOKIE_ACCEPT_POLICY_get();
+ internal static readonly int USER_AGENT = Interop.WebView.WebView_Property_USER_AGENT_get();
+ internal static readonly int ENABLE_JAVASCRIPT = Interop.WebView.WebView_Property_ENABLE_JAVASCRIPT_get();
+ internal static readonly int LOAD_IMAGES_AUTOMATICALLY = Interop.WebView.WebView_Property_LOAD_IMAGES_AUTOMATICALLY_get();
+ internal static readonly int DEFAULT_TEXT_ENCODING_NAME = Interop.WebView.WebView_Property_DEFAULT_TEXT_ENCODING_NAME_get();
+ internal static readonly int DEFAULT_FONT_SIZE = Interop.WebView.WebView_Property_DEFAULT_FONT_SIZE_get();
+ }
+
+ private static readonly BindableProperty UrlProperty = BindableProperty.Create(nameof(Url), typeof(string), typeof(WebView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var webview = (WebView)bindable;
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty(webview.swigCPtr, WebView.Property.URL, new Tizen.NUI.PropertyValue((string)newValue));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var webview = (WebView)bindable;
+ string temp;
+ Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.URL).Get(out temp);
+ return temp;
+ });
+
+ private static readonly BindableProperty CacheModelProperty = BindableProperty.Create(nameof(CacheModel), typeof(CacheModel), typeof(WebView), CacheModel.DocumentViewer, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var webview = (WebView)bindable;
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty(webview.swigCPtr, WebView.Property.CACHE_MODEL, new Tizen.NUI.PropertyValue((int)newValue));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var webview = (WebView)bindable;
+ string temp;
+ if (Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.CACHE_MODEL).Get(out temp) == false)
+ {
+ NUILog.Error("CacheModel get error!");
+ }
+ switch (temp)
+ {
+ case "DOCUMENT_VIEWER": return CacheModel.DocumentViewer;
+ case "DOCUMENT_BROWSER": return CacheModel.DocumentBrowser;
+ default: return CacheModel.PrimaryWebBrowser;
+ }
+ });
+
+ private static readonly BindableProperty CookieAcceptPolicyProperty = BindableProperty.Create(nameof(CookieAcceptPolicy), typeof(CookieAcceptPolicy), typeof(WebView), CookieAcceptPolicy.NoThirdParty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var webview = (WebView)bindable;
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty(webview.swigCPtr, WebView.Property.COOKIE_ACCEPT_POLICY, new Tizen.NUI.PropertyValue((int)newValue));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var webview = (WebView)bindable;
+ string temp;
+ if (Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.COOKIE_ACCEPT_POLICY).Get(out temp) == false)
+ {
+ NUILog.Error("CookieAcceptPolicy get error!");
+ }
+ switch (temp)
+ {
+ case "ALWAYS": return CookieAcceptPolicy.Always;
+ case "NEVER": return CookieAcceptPolicy.Never;
+ default: return CookieAcceptPolicy.NoThirdParty;
+ }
+ });
+
+ private static readonly BindableProperty UserAgentProperty = BindableProperty.Create(nameof(UserAgent), typeof(string), typeof(WebView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var webview = (WebView)bindable;
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty(webview.swigCPtr, WebView.Property.USER_AGENT, new Tizen.NUI.PropertyValue((string)newValue));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var webview = (WebView)bindable;
+ string temp;
+ Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.USER_AGENT).Get(out temp);
+ return temp;
+ });
+
+ private static readonly BindableProperty EnableJavaScriptProperty = BindableProperty.Create(nameof(EnableJavaScript), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var webview = (WebView)bindable;
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty(webview.swigCPtr, WebView.Property.ENABLE_JAVASCRIPT, new Tizen.NUI.PropertyValue((bool)newValue));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var webview = (WebView)bindable;
+ bool temp;
+ Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.ENABLE_JAVASCRIPT).Get(out temp);
+ return temp;
+ });
+
+ private static readonly BindableProperty LoadImagesAutomaticallyProperty = BindableProperty.Create(nameof(LoadImagesAutomatically), typeof(bool), typeof(WebView), true, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var webview = (WebView)bindable;
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty(webview.swigCPtr, WebView.Property.LOAD_IMAGES_AUTOMATICALLY, new Tizen.NUI.PropertyValue((bool)newValue));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var webview = (WebView)bindable;
+ bool temp;
+ Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.LOAD_IMAGES_AUTOMATICALLY).Get(out temp);
+ return temp;
+ });
+
+ private static readonly BindableProperty DefaultTextEncodingNameProperty = BindableProperty.Create(nameof(DefaultTextEncodingName), typeof(string), typeof(WebView), string.Empty, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var webview = (WebView)bindable;
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty(webview.swigCPtr, WebView.Property.DEFAULT_TEXT_ENCODING_NAME, new Tizen.NUI.PropertyValue((string)newValue));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var webview = (WebView)bindable;
+ string temp;
+ Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.DEFAULT_TEXT_ENCODING_NAME).Get(out temp);
+ return temp;
+ });
+
+ private static readonly BindableProperty DefaultFontSizeProperty = BindableProperty.Create(nameof(DefaultFontSize), typeof(int), typeof(WebView), 16, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ var webview = (WebView)bindable;
+ if (newValue != null)
+ {
+ Tizen.NUI.Object.SetProperty(webview.swigCPtr, WebView.Property.DEFAULT_FONT_SIZE, new Tizen.NUI.PropertyValue((int)newValue));
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ var webview = (WebView)bindable;
+ int temp;
+ Tizen.NUI.Object.GetProperty(webview.swigCPtr, WebView.Property.DEFAULT_FONT_SIZE).Get(out temp);
+ return temp;
+ });
+
/// <summary>
/// Creates an uninitialized WebView.
/// </summary>
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- internal WebView Assign(WebView webView)
+ /// <summary>
+ /// The url to load.
+ /// </summary>
+ public string Url
{
- WebView ret = new WebView(Interop.WebView.WebView_Assign(swigCPtr, WebView.getCPtr(webView)), false);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ get
+ {
+ return (string)GetValue(UrlProperty);
+ }
+ set
+ {
+ SetValue(UrlProperty, value);
+ NotifyPropertyChanged();
+ }
}
- internal static WebView DownCast(BaseHandle handle)
+ /// <summary>
+ /// The cache model of the current WebView.
+ /// </summary>
+ public CacheModel CacheModel
{
- WebView ret = new WebView(Interop.WebView.WebView_DownCast(BaseHandle.getCPtr(handle)), true);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return ret;
+ get
+ {
+ return (CacheModel)GetValue(CacheModelProperty);
+ }
+ set
+ {
+ SetValue(CacheModelProperty, value);
+ NotifyPropertyChanged();
+ }
}
/// <summary>
- /// Event arguments that passed via the webview signal.
+ /// The cookie acceptance policy.
/// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public class WebViewEventArgs : EventArgs
+ public CookieAcceptPolicy CookieAcceptPolicy
{
- private WebView _webView;
- /// <summary>
- /// The view for displaying webpages.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public WebView WebView
+ get
{
- get
- {
- return _webView;
- }
- set
- {
- _webView = value;
- }
+ return (CookieAcceptPolicy)GetValue(CookieAcceptPolicyProperty);
}
+ set
+ {
+ SetValue(CookieAcceptPolicyProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
- private string _pageUrl;
- /// <summary>
- /// The url string of current webpage.
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public string PageUrl
+ /// <summary>
+ /// The user agent string.
+ /// </summary>
+ public string UserAgent
+ {
+ get
{
- get
- {
- return _pageUrl;
- }
- set
- {
- _pageUrl = value;
- }
+ return (string)GetValue(UserAgentProperty);
+ }
+ set
+ {
+ SetValue(UserAgentProperty, value);
+ NotifyPropertyChanged();
}
}
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- private delegate void WebViewCallbackDelegate(IntPtr data, string pageUrl);
+ /// <summary>
+ /// Whether JavaScript is enabled.
+ /// </summary>
+ public bool EnableJavaScript
+ {
+ get
+ {
+ return (bool)GetValue(EnableJavaScriptProperty);
+ }
+ set
+ {
+ SetValue(EnableJavaScriptProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
- private void WebViewProxyConnect(global::System.Runtime.InteropServices.HandleRef proxy, System.Delegate func)
+ /// <summary>
+ /// Whether images can be loaded automatically.
+ /// </summary>
+ public bool LoadImagesAutomatically
{
- System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
+ get
+ {
+ return (bool)GetValue(LoadImagesAutomaticallyProperty);
+ }
+ set
{
- Interop.WebView.WebViewSignalProxy_Connect(proxy, new System.Runtime.InteropServices.HandleRef(this, ip));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ SetValue(LoadImagesAutomaticallyProperty, value);
+ NotifyPropertyChanged();
}
}
- private void WebViewProxyDisconnect(global::System.Runtime.InteropServices.HandleRef proxy, System.Delegate func)
+ /// <summary>
+ /// The default text encoding name.<br />
+ /// e.g. "UTF-8"<br />
+ /// </summary>
+ public string DefaultTextEncodingName
{
- System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func);
+ get
+ {
+ return (string)GetValue(DefaultTextEncodingNameProperty);
+ }
+ set
{
- Interop.WebView.WebViewSignalProxy_Disconnect(proxy, new System.Runtime.InteropServices.HandleRef(this, ip));
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ SetValue(DefaultTextEncodingNameProperty, value);
+ NotifyPropertyChanged();
}
}
- private EventHandler<WebViewEventArgs> pageLoadStartedEventHandler;
- private WebViewCallbackDelegate pageLoadStartedCallback;
+ /// <summary>
+ /// The default font size in pixel.
+ /// </summary>
+ public int DefaultFontSize
+ {
+ get
+ {
+ return (int)GetValue(DefaultFontSizeProperty);
+ }
+ set
+ {
+ SetValue(DefaultFontSizeProperty, value);
+ NotifyPropertyChanged();
+ }
+ }
/// <summary>
/// Event for the PageLoadStarted signal which can be used to subscribe or unsubscribe the event handler.<br />
/// This signal is emitted when page loading has started.<br />
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler<WebViewEventArgs> PageLoadStarted
+ public event EventHandler<WebViewPageLoadEventArgs> PageLoadStarted
{
add
{
if (pageLoadStartedEventHandler == null)
{
pageLoadStartedCallback = (OnPageLoadStarted);
- WebViewProxyConnect(pageLoadStartedSignalProxy, pageLoadStartedCallback);
+ pageLoadStartedSignal.Connect(pageLoadStartedCallback);
}
pageLoadStartedEventHandler += value;
}
pageLoadStartedEventHandler -= value;
if (pageLoadStartedEventHandler == null && pageLoadStartedCallback != null)
{
- WebViewProxyDisconnect(pageLoadStartedSignalProxy, pageLoadStartedCallback);
+ pageLoadStartedSignal.Disconnect(pageLoadStartedCallback);
}
}
}
- private void OnPageLoadStarted(IntPtr data, string pageUrl)
- {
- WebViewEventArgs e = new WebViewEventArgs();
-
- e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
- e.PageUrl = pageUrl;
-
- if (pageLoadStartedEventHandler != null)
- {
- pageLoadStartedEventHandler(this, e);
- }
- }
-
- private EventHandler<WebViewEventArgs> pageLoadFinishedEventHandler;
- private WebViewCallbackDelegate pageLoadFinishedCallback;
-
/// <summary>
/// Event for the PageLoadFinished signal which can be used to subscribe or unsubscribe the event handler.<br />
/// This signal is emitted when page loading has finished.<br />
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public event EventHandler<WebViewEventArgs> PageLoadFinished
+ public event EventHandler<WebViewPageLoadEventArgs> PageLoadFinished
{
add
{
if (pageLoadFinishedEventHandler == null)
{
pageLoadFinishedCallback = (OnPageLoadFinished);
- WebViewProxyConnect(pageLoadFinishedSignalProxy, pageLoadFinishedCallback);
+ pageLoadFinishedSignal.Connect(pageLoadFinishedCallback);
}
pageLoadFinishedEventHandler += value;
}
pageLoadFinishedEventHandler -= value;
if (pageLoadFinishedEventHandler == null && pageLoadFinishedCallback != null)
{
- WebViewProxyDisconnect(pageLoadFinishedSignalProxy, pageLoadFinishedCallback);
+ pageLoadFinishedSignal.Disconnect(pageLoadFinishedCallback);
}
}
}
- private void OnPageLoadFinished(IntPtr data, string pageUrl)
+ /// <summary>
+ /// Event for the PageLoadError signal which can be used to subscribe or unsubscribe the event handler.<br />
+ /// This signal is emitted when there's an error in page loading.<br />
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public event EventHandler<WebViewPageLoadErrorEventArgs> PageLoadError
{
- WebViewEventArgs e = new WebViewEventArgs();
-
- e.WebView = Registry.GetManagedBaseHandleFromNativePtr(data) as WebView;
- e.PageUrl = pageUrl;
-
- if (pageLoadFinishedEventHandler != null)
+ add
{
- pageLoadFinishedEventHandler(this, e);
+ if (pageLoadErrorEventHandler == null)
+ {
+ pageLoadErrorCallback = (OnPageLoadError);
+ pageLoadErrorSignal.Connect(pageLoadErrorCallback);
+ }
+ pageLoadErrorEventHandler += value;
+ }
+ remove
+ {
+ pageLoadErrorEventHandler -= value;
+ if (pageLoadErrorEventHandler == null && pageLoadErrorCallback != null)
+ {
+ pageLoadErrorSignal.Disconnect(pageLoadErrorCallback);
+ }
}
}
/// <summary>
/// Returns the URL of the Web
- /// <returns>Url of string type</returns>
- /// </summary>
- [EditorBrowsable(EditorBrowsableState.Never)]
- public string GetUrl()
- {
- string url = Interop.WebView.WebView_GetUrl(swigCPtr);
- if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
- return url;
- }
-
- /// <summary>
- /// Returns the URL of the Web
/// <param name="data">The data of Web</param>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
}
/// <summary>
+ /// Suspends the operation.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Suspend()
+ {
+ Interop.WebView.WebView_Suspend(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
+ /// Resumes the operation after calling Suspend()
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void Resume()
+ {
+ Interop.WebView.WebView_Resume(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
+
+ /// <summary>
/// Goes to the back
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
}
/// <summary>
+ /// The callback function that is invoked when the message is received from the script.
+ /// </summary>
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public delegate void JavaScriptMessageHandler(string message);
+
+ /// <summary>
/// Evaluates JavaScript code represented as a string.
/// <param name="script">The JavaScript code</param>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public void EvaluateJavaScript(string script)
{
- Interop.WebView.WebView_EvaluateJavaScript(swigCPtr, script);
+ Interop.WebView.WebView_EvaluateJavaScript(swigCPtr, script, new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
- /// <summary>
- /// The callback function that is invoked when the message is received from the script.
- /// </summary>
- [UnmanagedFunctionPointer(CallingConvention.StdCall)]
- [EditorBrowsable(EditorBrowsableState.Never)]
- public delegate void JavaScriptMessageHandler(string message);
-
-
// For rooting handlers
internal Dictionary<string, JavaScriptMessageHandler> handlerRootMap = new Dictionary<string, JavaScriptMessageHandler>();
}
/// <summary>
- /// Clears the history of Web.
+ /// Clears the history of current WebView.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public void ClearHistory()
}
/// <summary>
- /// Clears the cache of Web.
+ /// Clears the cache of current WebView.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
public void ClearCache()
Interop.WebView.WebView_ClearCache(swigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
+
+ /// <summary>
+ /// Clears all the cookies of current WebView.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public void ClearCookies()
+ {
+ Interop.WebView.WebView_ClearCookies(swigCPtr);
+ if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ }
}
}