public void NewDataHandler(QuoteBook book) { string instrString = Utilities.InstrToStr(book.Instr); if (_watchListDict.ContainsKey(instrString)) { _watchListDict[instrString].UpdateQuoteBook(book); } else { lock (_watchListDict) { if (_watchListDict.ContainsKey(instrString)) { _watchListDict[instrString].UpdateQuoteBook(book); } else { WatchListTableObj obj = new WatchListTableObj(book); _watchListDict.TryAdd(instrString, obj); _watchListBinding.Add(obj); } } } }
public void NewDataHandler(TradeInfo trade) { string instrString = Utilities.InstrToStr(trade.Instr); if (_watchListDict.ContainsKey(instrString)) { _watchListDict[instrString].UpdateTradeInfo(trade); } else { lock (_watchListDict) { if (_watchListDict.ContainsKey(instrString)) { _watchListDict[instrString].UpdateTradeInfo(trade); } else { WatchListTableObj obj = new WatchListTableObj(trade); _watchListDict.TryAdd(instrString, obj); _watchListBinding.Add(obj); } } } }
private void gridView1_RowCellStyle(object sender, RowCellStyleEventArgs e) { GridView view = sender as GridView; if (view.GetRowCellValue(e.RowHandle, view.Columns["Sym"]) != null) { WatchListTableObj selected = _watchListBinding[gridView1.GetDataSourceRowIndex(e.RowHandle)]; if (e.Column.Caption.Equals("BidSz")) { if (selected.PrevBidSz != 0 && selected.BidSz > selected.PrevBidSz) { e.Appearance.ForeColor = System.Drawing.Color.Green; } else if (selected.PrevBidSz != 0 && selected.BidSz < selected.PrevBidSz) { e.Appearance.ForeColor = System.Drawing.Color.Red; } } else if (e.Column.Caption.Equals("AskSz")) { if (selected.PrevAskSz != 0 && selected.AskSz > selected.PrevAskSz) { e.Appearance.ForeColor = System.Drawing.Color.Green; } else if (selected.PrevAskSz != 0 && selected.AskSz < selected.PrevAskSz) { e.Appearance.ForeColor = System.Drawing.Color.Red; } } else if (e.Column.Caption.Equals("Bid")) { if (selected.PrevBid != 0 && selected.Bid > selected.PrevBid) { e.Appearance.ForeColor = System.Drawing.Color.Green; } else if (selected.PrevBid != 0 && selected.Bid < selected.PrevBid) { e.Appearance.ForeColor = System.Drawing.Color.Red; } } else if (e.Column.Caption.Equals("Ask")) { if (selected.PrevAsk != 0 && selected.Ask > selected.PrevAsk) { e.Appearance.ForeColor = System.Drawing.Color.Green; } else if (selected.PrevAsk != 0 && selected.Ask < selected.PrevAsk) { e.Appearance.ForeColor = System.Drawing.Color.Red; } } else if (e.Column.Caption.Equals("Last")) { if (selected.PrevLast != 0 && selected.Last > selected.PrevLast) { e.Appearance.ForeColor = System.Drawing.Color.Green; } else if (selected.PrevLast != 0 && selected.Last < selected.PrevLast) { e.Appearance.ForeColor = System.Drawing.Color.Red; } } } }