Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/list/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
GeckoFX-如果页面加载完成,则执行事件(.NET)_.net_Geckofx - Fatal编程技术网

GeckoFX-如果页面加载完成,则执行事件(.NET)

GeckoFX-如果页面加载完成,则执行事件(.NET),.net,geckofx,.net,Geckofx,我试图让我的geckofx浏览器等待页面加载“类似DocumentComplete的内容”,但我做不到,我使用的是geckofx 1.9.2,我想这就是问题所在,也许这个版本不支持DocumentComplete事件,这就是我试图做的一个示例: Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim uAgent As String

我试图让我的geckofx浏览器等待页面加载“类似DocumentComplete的内容”,但我做不到,我使用的是geckofx 1.9.2,我想这就是问题所在,也许这个版本不支持DocumentComplete事件,这就是我试图做的一个示例:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim uAgent As String = "Mozilla/5.0 (Linux; U; Android 2.3.5; en-US; GT-I9100 Build/GINGERBREAD) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 UCBrowser/10.3.0.552 U3/0.8.0 Mobile Safari/534.30"
    Skybound.Gecko.GeckoPreferences.User("general.useragent.override") = uAgent
    GeckoWebBrowser1.Navigate("google.com")

    If GeckoWebBrowser1.DocumentComplete = True Then 
    Messagebox.show("Page Loaded !", "Done")
    End If
End Sub

你可以在这里检查你的GeckoFX版本支持什么

除此之外,您还需要设计一些不同的代码。 初始化并首次使用浏览器时,请将事件处理程序附加到事件

就我在最早的GeckoFX版本的代码中所见,它确实支持
DocumentCompleted
事件

    #region public event EventHandler DocumentCompleted
    /// <summary>
    /// Occurs after the browser has finished parsing a new page and updated the <see cref="Document"/> property.
    /// </summary>
    [Category("Navigation"), Description("Occurs after the browser has finished parsing a new page and updated the Document property.")]
    public event EventHandler DocumentCompleted
    {
        add { this.Events.AddHandler(DocumentCompletedEvent, value); }
        remove { this.Events.RemoveHandler(DocumentCompletedEvent, value); }
    }
#区域公共事件事件处理程序文档已完成
/// 
///在浏览器完成对新页的分析并更新属性后发生。
/// 
[类别(“导航”)、说明(“在浏览器完成对新页面的解析并更新文档属性后发生”)]
公共事件事件处理程序文档已完成
{
添加{this.Events.AddHandler(DocumentCompletedEvent,value);}
删除{this.Events.RemoveHandler(DocumentCompletedEvent,value);}
}
这意味着您可以将处理程序附加到此事件,并且每当浏览器完成导航时,都将调用该处理程序。 将加载后要执行的代码放入事件处理程序中