Esempio n. 1
0
 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();
     }
 }
Esempio n. 2
0
        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);
                }
            }
        }
Esempio n. 3
0
 private void Browser_DocumentCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e)
 {
     PageFinished?.Invoke(sender, e);
 }
Esempio n. 4
0
 private void Browser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
 {
     PageFinished?.Invoke(sender, e);
 }
Esempio n. 5
0
 public override void OnPageFinished(WebView view, string url)
 {
     PageFinished?.Invoke(this, null);
 }