private void DoneLoadingDelay(object sender, EventArgs e) { try { if (!IsLoading) { delayTimer.Stop(); if (LoadingSplash.InvokeRequired) { LoadingSplash.Invoke(new Action(() => LoadingSplash.Visible = false)); } else { LoadingSplash.Visible = false; } } } catch { } }
private void ChromeBrowser_LoadingStateChanged(object sender, LoadingStateChangedEventArgs e) { if (e.IsLoading) { IsLoading = true; if (LoadingSplash.InvokeRequired) { LoadingSplash.Invoke(new Action(() => LoadingSplash.Visible = true)); } else { LoadingSplash.Visible = true; } } else if (!e.IsLoading) { IsLoading = false; delayTimer = new System.Windows.Forms.Timer { Interval = 500 }; delayTimer.Tick += DoneLoadingDelay; delayTimer.Start(); } }