Beispiel #1
0
        private async Task <bool> PublishPriceChange()
        {
            bool isFinished = false;
            await Task.Run(() =>
            {
                try
                {
                    lock (_locker)
                    {
                        Random random = RandomProvider.GetThreadRandom();
                        for (int i = 0; i < 240; i++)     // 8 hours => 4 minutes = 240 seconds
                        {
                            Thread.Sleep(1000);
                            TransformPrices(_quotes, random);
                            PriceChangeEventArgs e = new PriceChangeEventArgs(_quotes);
                            PriceChanged(this, e);
                        }
                        isFinished = true;
                    }
                }
                catch (Exception)
                {
                }
            });

            return(isFinished);
        }
 private async Task<bool> PublishPriceChange()
 {
     bool isFinished = false;
     await Task.Run(() =>
         {
             try
             {
                 lock (_locker)
                 {
                     Random random = RandomProvider.GetThreadRandom();
                     for (int i = 0; i < 240; i++) // 8 hours => 4 minutes = 240 seconds
                     {
                         Thread.Sleep(1000);
                         TransformPrices(_quotes, random);
                         PriceChangeEventArgs e = new PriceChangeEventArgs(_quotes);
                         PriceChanged(this, e);
                     }
                     isFinished = true;
                 }
             }
             catch (Exception)
             {                        
                 
             }                                        
         });
     return isFinished;
 }
 public void PriceChangeHandler(object sender, PriceChangeEventArgs e)
 {
     _callback.PriceChange(e.Quotes);
 }
Beispiel #4
0
 public void PriceChangeHandler(object sender, PriceChangeEventArgs e)
 {
     _callback.PriceChange(e.Quotes);
 }