Esempio n. 1
0
 internal void StartPriceService()
 {
     if (!TestModeActivated)
     {
         _priceService.Start();
     }
 }
        private void StartPriceService(object parameter)
        {
            _token = new CancellationTokenSource();

            _producer = Task.Factory.StartNew(() =>
            {
                if (_token.Token.IsCancellationRequested)
                {
                    StopPriceService(null);
                }
                priceService.Start();
            }, _token.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);
            toggleButton = false;

            StartConsumer();
            priceService.NewPricesArrived += PriceUpdateHandler;
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            var priceService = new RandomWalkPriceService();

            priceService.NewPricesArrived += PriceUpdateHandler;
            priceService.Start();

            while (true)
            {
                ConsoleKeyInfo key = Console.ReadKey();
                if (key.Key == ConsoleKey.D)
                {
                    Console.WriteLine("Done");
                    break;
                }
            }

            priceService.Stop();
        }