protected void RaisePageFinished(string path, int id, List <DataRecord> records) { if (records.Count > 0) { PageFinished?.Invoke(this, new PageFinishedArgs { Records = records, Path = path, Id = id }); records.Clear(); records.TrimExcess(); GC.Collect(); } }
private void Elapse(object target) { int tid = Thread.CurrentThread.ManagedThreadId; bool lockTaken = false; try { lockTaken = Monitor.TryEnter(timerLockObject); if (!lockTaken) { return; } long latestTolerableTick = DateTime.Now.Ticks - TimeSpan.TicksPerMillisecond * HeartbeatTimeout; foreach (var kvp in heartbeat.Where(kvp => kvp.Value < latestTolerableTick).ToArray()) { heartbeat.Remove(kvp.Key); } if (heartbeat.Count < 1 && TargetUrl != null) { SetMessage("Please open '" + TargetUrl + "' with your system browser.", true); browserReady = false; } else if (heartbeat.Count > 1) { SetMessage("Too many clients! Only one tab page of one browser may be connected."); browserReady = false; } else { if (!browserReady) { SetMessage("Browser connected. #" + heartbeat.First().Key); PageFinished?.Invoke(this, new EventArgs()); } browserReady = true; } } finally { if (lockTaken) { Monitor.Exit(timerLockObject); } } }
private void Browser_DocumentCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e) { PageFinished?.Invoke(sender, e); }
private void Browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e) { PageFinished?.Invoke(sender, e); }
public override void OnPageFinished(WebView view, string url) { PageFinished?.Invoke(this, null); }