public static void SetInterceptRequestCallback(this TWebView webView, InterceptRequestCallback callback)
        {
#pragma warning disable CA1062 // Validate arguments of public methods
            var context = webView.GetContext();
#pragma warning restore CA1062 // Validate arguments of public methods
            var handleField   = context.GetType().GetField("_handle", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            var contextHandle = (IntPtr)handleField.GetValue(context);
            ewk_context_intercept_request_callback_set(contextHandle, callback, IntPtr.Zero);
        }
Пример #2
0
        public static void SetInterceptRequestCallback(this TWebView webView, InterceptRequestCallback callback)
        {
            var context       = webView.GetContext();
            var handleField   = context.GetType().GetField("_handle", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            var contextHandle = (IntPtr?)handleField?.GetValue(context);

            if (contextHandle != null)
            {
                ewk_context_intercept_request_callback_set(contextHandle.Value, callback, IntPtr.Zero);
            }
        }
#pragma warning disable IDE1006 // Naming Styles
        internal static extern void ewk_context_intercept_request_callback_set(IntPtr context, InterceptRequestCallback callback, IntPtr userData);