首先我在C#中的新手和學習Cefsharp + JavaScript的,因爲我去,所以請嘗試評論你覺得有必要的任何解決方案,一定會來救我問愚蠢的問題。cefsharp等待頁面加載,的WinForms C#
我試圖等到頁面完成與Cefsharp加載執行我的代碼,我已經試過其他計算器問題/ github上,但沒有去發現了幾個解決方案...
我認爲解決方案是「NavStateChanged」,但我得到的C#錯誤: 「ChromiumWebBrowser不包含'NavStateChanged'的定義」
任何人都可以指向正確的方向或拋出一個片段?我不要求你爲我寫了整個事情,但我真的失去了這裏,即時學習C#,Cefsharp & JavaScript的一次性和幸福......其壓倒性。
這是我發現的,而尋找一個解決方案網上的代碼,它也符合了很多GitHub的引用,但似乎並沒有工作:/
EventHandler<NavStateChangedEventArgs> handler = null;
handler = (sender, args) = > {
//TODO : show a loading gif until the page load completes
//Wait for while page to finish loading not just the first frame
if (!args.IsLoading)
{
chromeBrowser.NavStateChanged -= handler;
MessageBox.Show("The page has completed loading", "Load completed", MessageBoxButtons.OK);
//TODO : once load complete show the actual page
}
這些例子都過時了。閱讀https://github.com/cefsharp/CefSharp/wiki/General-Usage#handlers – amaitland