diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json
new file mode 100644
index 0000000..f8b4888
--- /dev/null
+++ b/.vs/ProjectSettings.json
@@ -0,0 +1,3 @@
+{
+ "CurrentProjectSetting": null
+}
\ No newline at end of file
diff --git a/.vs/WpfMiniBlink/v16/.suo b/.vs/WpfMiniBlink/v16/.suo
index 44124b6..fd24d76 100644
Binary files a/.vs/WpfMiniBlink/v16/.suo and b/.vs/WpfMiniBlink/v16/.suo differ
diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite
new file mode 100644
index 0000000..d9f1ac7
Binary files /dev/null and b/.vs/slnx.sqlite differ
diff --git a/WpfCoreMiniBlink/MBApi.cs b/WpfCoreMiniBlink/MBApi.cs
index d5b19b8..2705429 100644
--- a/WpfCoreMiniBlink/MBApi.cs
+++ b/WpfCoreMiniBlink/MBApi.cs
@@ -1445,8 +1445,27 @@ public static void wkeOnDocumentReady2(IntPtr webView, wkeDocumentReady2Callback
}
}
- //[DllImport(DLL_x86, EntryPoint = "wkeOnLoadingFinish", CallingConvention = CallingConvention.Cdecl)]
- //public static extern void wkeOnLoadingFinish(IntPtr webView, wkeLoadingFinishCallback callback, IntPtr param);
+ [DllImport(DLL_x86, EntryPoint = "wkeOnLoadingFinish", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void wkeOnLoadingFinish_x86(IntPtr webView, wkeLoadingFinishCallback callback, IntPtr param);
+ [DllImport(DLL_x64, EntryPoint = "wkeOnLoadingFinish", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void wkeOnLoadingFinish_x64(IntPtr webView, wkeLoadingFinishCallback callback, IntPtr param);
+ ///
+ /// 页面所有元素加载完成会调用。
+ ///
+ ///
+ ///
+ ///
+ public static void wkeOnLoadingFinish(IntPtr webView, wkeLoadingFinishCallback callback, IntPtr param)
+ {
+ if (is64())
+ {
+ wkeOnLoadingFinish_x64(webView, callback, param);
+ }
+ else
+ {
+ wkeOnLoadingFinish_x86(webView, callback, param);
+ }
+ }
[DllImport(DLL_x86, EntryPoint = "wkeOnDownload", CallingConvention = CallingConvention.Cdecl)]
private static extern void wkeOnDownload_x86(IntPtr webView, wkeDownloadCallback callback, IntPtr param);
diff --git a/WpfCoreMiniBlink/MBEvents.cs b/WpfCoreMiniBlink/MBEvents.cs
index 4a6da23..f6d9edc 100644
--- a/WpfCoreMiniBlink/MBEvents.cs
+++ b/WpfCoreMiniBlink/MBEvents.cs
@@ -43,6 +43,19 @@ internal DocumentReadyEventArgs()
}
}
+ public class LoadingFinishEventArgs : MiniblinkEventArgs
+ {
+ public string Url { get; set; }
+ public string FailedReason { get; set; }
+
+ public wkeLoadingResult LoadingResult { get; set; }
+
+ internal LoadingFinishEventArgs()
+ {
+
+ }
+ }
+
public class ConsoleMessageEventArgs : MiniblinkEventArgs
{
public wkeConsoleLevel Level { get; internal set; }
diff --git a/WpfCoreMiniBlink/MiniblinkBrowser.cs b/WpfCoreMiniBlink/MiniblinkBrowser.cs
index 81c1ec9..c703f04 100644
--- a/WpfCoreMiniBlink/MiniblinkBrowser.cs
+++ b/WpfCoreMiniBlink/MiniblinkBrowser.cs
@@ -507,6 +507,33 @@ protected virtual void OnDocumentReady(IntPtr mb, IntPtr param, IntPtr frameId)
});
}
+ private wkeLoadingFinishCallback _wkeLoadingFinish;
+ private EventHandler _loadingFinish;
+ ///
+ /// 页面加载完成事件。
+ ///
+ public event EventHandler LoadingFinish
+ {
+ add
+ {
+ if (_wkeLoadingFinish == null)
+ {
+ MBApi.wkeOnLoadingFinish(MiniblinkHandle, _wkeLoadingFinish = new wkeLoadingFinishCallback(OnLoadingFinish), IntPtr.Zero);
+ }
+ _loadingFinish += value;
+ }
+ remove
+ {
+ _loadingFinish -= value;
+ }
+ }
+
+ protected virtual void OnLoadingFinish(IntPtr webView, IntPtr param, IntPtr url, wkeLoadingResult result,
+ IntPtr failedReason)
+ {
+ _loadingFinish?.Invoke(this, new LoadingFinishEventArgs() { FailedReason = failedReason.WKEToUTF8String(), LoadingResult = result, Url = url.WKEToUTF8String() });
+ }
+
private wkeConsoleCallback _wkeConsoleMessage;
private EventHandler _consoleMessage;