Exemplo n.º 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);
        }
Exemplo n.º 2
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;
 }
Exemplo n.º 3
0
 public void PriceChangeHandler(object sender, PriceChangeEventArgs e)
 {
     _callback.PriceChange(e.Quotes);
 }
Exemplo n.º 4
0
 public void PriceChangeHandler(object sender, PriceChangeEventArgs e)
 {
     _callback.PriceChange(e.Quotes);
 }