CefSharp.wpf 网络浏览器导航事件(C# .Net)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32461311/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
CefSharp.wpf web browser navigated event (C# .Net)
提问by Ali Baig
Is it possible to hook up an event like Navigated with the Webbrowser control (built-in)? I need to perform oAuth in a desktop application and there i need to know if the authentication code has been added to the redirect_uri.
是否可以将 Navigated 等事件与 Webbrowser 控件(内置)关联起来?我需要在桌面应用程序中执行 oAuth,我需要知道身份验证代码是否已添加到 redirect_uri。
I was using WebBrowser control that is built in and has the events like Navigating and Navigated but i was facing an issue regarding ieframe.dll/navcancl.htm so i decided to go with CefSharp.wpf ChromiumWebBrowser but I'm not being able to locate any events that can be called when the browser has finished navigating to the URL.
我正在使用内置的 WebBrowser 控件并具有 Navigating 和 Navigated 等事件,但我遇到了关于 ieframe.dll/navcancl.htm 的问题,所以我决定使用 CefSharp.wpf ChromiumWebBrowser,但我无法找到当浏览器完成导航到 URL 时可以调用的任何事件。
This is what i have done in the xaml
这是我在 xaml 中所做的
<wpf:ChromiumWebBrowser Grid.Row="0" Grid.Column="0"
x:Name="ChromiumBrowser"
WebBrowser="{Binding WebBrowser, Mode=OneWayToSource}" FrameLoadStart="ChromiumBrowser_OnFrameLoadStart"
Title="{Binding Title, Mode=TwoWay}" />
and when the user requests to authenticate, I'm setting the address like
当用户请求进行身份验证时,我设置的地址如下
ChromiumBrowser.Address = NavigateUrl
采纳答案by Glen Thomas
The ChromiumWebBrowserhas a LoadingStateChangedevent with LoadingStateChangedArgs, which has an IsLoadingproperty. It also has a FrameLoadEndevent, which is raised when a frame in the page finishes loading.
该ChromiumWebBrowser有一个LoadingStateChanged与事件LoadingStateChangedArgs,其中有一个IsLoading属性。它还有一个FrameLoadEnd事件,当页面中的一个框架完成加载时会引发该事件。

