public MonitorViewModel() { SendCommand = new RelayCommand(new Action <object>(SendOrder)); _refreshTime = new TimeSpan(Period); Application.Current.MainWindow.Closing += new CancelEventHandler(CloseApp); Instruments = new Instrument[_collectionSize]; InitializeCollection(); _priceService = new RandomWalkPriceService(); _priceService.NewPricesArrived += PriceUpdateHandler; }
public DisplayMainWindowViewModel() { BindingOperations.EnableCollectionSynchronization(_instrumentsCache, _syncLock); toggleButton = true; StartCommand = new DelegateCommand(StartPriceService, EnableStartButton); StopCommand = new DelegateCommand(StopPriceService, EnableStopButton); priceService = new RandomWalkPriceService(); var delayedInterval = ConfigurationManager.AppSettings["DelayedUpdateInterval"]; var interval = Convert.ToInt32(delayedInterval); if (interval != 0) { StartTimer(interval); } }
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(); }