private void PriceUpdateHandler(PriceDTO priceUpdate) { // This needs some optimization try { int mid = priceUpdate.MarketId; if (_Instruments[mid] == null) { _Instruments.Add(new Instrument(mid, InstrumentHelpers.GetSymbol(mid))); } _Instruments[mid].Bid = priceUpdate.Bid; _Instruments[mid].Ask = priceUpdate.Offer; _Instruments[mid].High = priceUpdate.High; _Instruments[mid].Low = priceUpdate.High; _Instruments[mid].LastUpdate = JSONParser.ParseJSONDateToUtc(priceUpdate.TickDate); _Instruments[mid].Change = priceUpdate.Change; _Instruments[mid].Direction = priceUpdate.Direction; if (priceUpdate.Direction == 1) _Instruments[mid].UpDown = _Instruments.UpImage; else _Instruments[mid].UpDown = _Instruments.DownImage; _Instruments[mid].AuditId = priceUpdate.AuditId; } catch (Exception ex) { } }
private void HandlePriceUpdate(PriceDTO priceUpdate) { if (this.InvokeRequired) { this.Invoke(new PriceUpdateHandlerDelegate(PriceUpdateHandler), priceUpdate); } }