Example #1
0
 private void UpdateStatistics()
 {
     if (_lastUpdateStatistics == null || DateTime.Now - _lastUpdateStatistics >= new TimeSpan(0, 0, 1))
     {
         _updateStatistics.BeginInvoke(null, null);
         _lastUpdateStatistics = DateTime.Now;
     }
 }
Example #2
0
        private async void Completed(object sender, RunWorkerCompletedEventArgs e)
        {
            if (!e.Cancelled)
            {
                if (Notify != null && e.Result != null)
                {
                    Notify.BeginInvoke((List <StockInfo>)e.Result, null, null);
                }
            }

            await Task.Delay(_frequency);

            if (!_bWorker.CancellationPending && !e.Cancelled && !_bWorker.IsBusy)
            {
                _bWorker.RunWorkerAsync();
            }
            ;
        }