/// <summary> /// /// </summary> public MarketWatchControl(MarketWatchComponent component) : base(component) { InitializeComponent(); }
void component_QuotesUpdateEvent(MarketWatchComponent component, MarketWatchComponent.SymbolInformation information) { //WinFormsHelper.BeginFilteredManagedInvoke(this, DoUpdateUI); }
void SetItemAsQuote(ListViewItem item, MarketWatchComponent.SymbolInformation information) { if (item.Text != information.Symbol.Name) { item.Text = information.Symbol.Name; } item.UseItemStyleForSubItems = false; item.Tag = information.Symbol; Color subItemColor = listViewQuotes.BackColor; if (information.IsUpDownTimedOut == false) { subItemColor = information.IsUpFromPrevious ? Color.YellowGreen : Color.DarkSalmon; } if (item.SubItems[1].BackColor != subItemColor) { item.SubItems[1].BackColor = subItemColor; item.SubItems[2].BackColor = subItemColor; } string subItemText1 = "-"; string subItemText2 = "-"; if (information.Quote.HasValue) { subItemText1 = information.Quote.Value.Ask.ToString(); subItemText2 = information.Quote.Value.Bid.ToString(); item.SubItems[3].Text = GeneralHelper.ToString(information.Quote.Value.Spread); item.SubItems[4].Text = GeneralHelper.ToString(information.Quote.Value.High); item.SubItems[5].Text = GeneralHelper.ToString(information.Quote.Value.Low); } if (item.SubItems[1].Text != subItemText1) { item.SubItems[1].Text = subItemText1; } if (item.SubItems[2].Text != subItemText2) { item.SubItems[2].Text = subItemText2; } }