C# NanUI WinFormium监听页面加载开始\结束

/ 0 条评论 / 256人阅读

因为NanUI文档中仅介绍了Formium窗口的监听,但是没有WinFormium相关的文档,查看源码后才找到监听方法,特此记录一下

public partial class Form1 : WinFormium
{public Form1(): base("http://res.app.local/asserts/index.html")
{
	InitializeComponent();
        FileManager fm = new FileManager();
	LoadHandler.OnLoadStart += LoadHandler_OnLoadStart;
        LoadHandler.OnLoadEnd += LoadHandler_OnLoadEnd;
}

//监听页面加载完成
private void LoadHandler_OnLoadEnd(object sender, Chromium.Event.CfxOnLoadEndEventArgs e)
 {
     // Check if it is the main frame when page has loaded.
            
     //     ExecuteJavascript("sayHello()");
            
}
//监听页面加载结束
private void LoadHandler_OnLoadStart(object sender, Chromium.Event.CfxOnLoadStartEventArgs e)
{
    #if DEBUG
	Chromium.ShowDevTools();
    #endif
}
}

Responses /