private void TopActiveUpdateToGrid(int rowIndex, frmStockRanking.RecordData recordData, StockList.StockInformation realStockInfo) { if (this.intzaTopActive.InvokeRequired) { this.intzaTopActive.Invoke(new frmStockRanking.TopActiveUpdateToGridCallBack(this.TopActiveUpdateToGrid), new object[] { rowIndex, recordData, realStockInfo }); } else { try { RecordItem recordItem; if (rowIndex >= 0) { recordItem = this.intzaTopActive.Records(rowIndex); } else { recordItem = this.intzaTopActive.Find("stock", recordData.Stock); if (recordItem == null) { recordItem = this.intzaTopActive.Records(this.maxRecordTopActive - 1); } } recordItem.Fields("stock").Text = recordData.Stock; recordItem.Fields("stock").Tag = recordData.DisplayFlag; recordItem.Fields("deals").Text = recordData.Deals; recordItem.Fields("volume").Text = recordData.AccVolume; recordItem.Fields("value").Text = recordData.AccValue; decimal num = 0m; if (recordData.AccVolume > 0L) { num = Math.Round(recordData.AccValue / recordData.AccVolume, 2); } recordItem.Fields("avg").Text = num; recordItem.Fields("high").Text = recordData.HighPrice; recordItem.Fields("low").Text = recordData.LowPrice; recordItem.Fields("last").Text = recordData.LastPrice; recordItem.Fields("swing").Text = recordData.Swing; recordItem.Fields("pswing").Text = recordData.SwingPct; recordItem.Fields("chg").Text = recordData.ChangePrice; recordItem.Fields("pchg").Text = recordData.ChangePricePct; Color fontColor = Utilities.ComparePriceCFColor(recordData.LastPrice, realStockInfo); recordItem.Fields("stock").FontColor = fontColor; recordItem.Fields("deals").FontColor = fontColor; recordItem.Fields("volume").FontColor = fontColor; recordItem.Fields("value").FontColor = fontColor; recordItem.Fields("last").FontColor = fontColor; recordItem.Fields("chg").FontColor = fontColor; recordItem.Fields("pchg").FontColor = fontColor; recordItem.Fields("swing").FontColor = fontColor; recordItem.Fields("pswing").FontColor = fontColor; recordItem.Fields("avg").FontColor = Utilities.ComparePriceCFColor(num, realStockInfo); recordItem.Fields("high").FontColor = Utilities.ComparePriceCFColor(recordData.HighPrice, realStockInfo); recordItem.Fields("low").FontColor = Utilities.ComparePriceCFColor(recordData.LowPrice, realStockInfo); } catch (Exception ex) { this.ShowError("TopActiveUpdateToGrid", ex); } } }
private void TopActiveUpdateUIReloadData(frmStockRanking.ActiveGroupTypes activeGroupType) { if (base.InvokeRequired) { base.Invoke(new frmStockRanking.TopActiveUpdateUIReloadDataCallback(this.TopActiveUpdateUIReloadData), new object[] { activeGroupType }); } else { try { this.intzaTopActive.GetColumn("value").Text = "Value"; this.intzaTopActive.GetColumn("volume").Text = "Volume"; this.intzaTopActive.GetColumn("avg").Text = "Avg"; switch (activeGroupType) { case frmStockRanking.ActiveGroupTypes.MostActive_Main: case frmStockRanking.ActiveGroupTypes.MostActive_Foreign: this.sortTypeTopActive = SortType.Desc; this.sortByNameTopActive = "value"; break; case frmStockRanking.ActiveGroupTypes.MostActive_BigLot: this.sortTypeTopActive = SortType.Desc; this.sortByNameTopActive = "value"; this.intzaTopActive.GetColumn("value").Text = "BValue"; this.intzaTopActive.GetColumn("volume").Text = "BVolume"; this.intzaTopActive.GetColumn("avg").Text = "BAvg"; break; case frmStockRanking.ActiveGroupTypes.Gainer_Main: case frmStockRanking.ActiveGroupTypes.Gainer_Foreign: this.sortTypeTopActive = SortType.Desc; this.sortByNameTopActive = "pchg"; break; case frmStockRanking.ActiveGroupTypes.Loser_Main: case frmStockRanking.ActiveGroupTypes.Loser_Foreign: this.sortTypeTopActive = SortType.Asc; this.sortByNameTopActive = "pchg"; break; case frmStockRanking.ActiveGroupTypes.MostSwing_Main: case frmStockRanking.ActiveGroupTypes.MostSwing_Foreign: this.sortTypeTopActive = SortType.Desc; this.sortByNameTopActive = "pswing"; break; default: return; } switch (activeGroupType) { case frmStockRanking.ActiveGroupTypes.MostActive_Main: this.tscbTopActiveType.Text = "Most Active - Main"; break; case frmStockRanking.ActiveGroupTypes.MostActive_Foreign: this.tscbTopActiveType.Text = "Most Active - Foreign"; break; case frmStockRanking.ActiveGroupTypes.MostActive_BigLot: this.tscbTopActiveType.Text = "Biglot"; break; case frmStockRanking.ActiveGroupTypes.Gainer_Main: this.tscbTopActiveType.Text = "Gainer - Main"; break; case frmStockRanking.ActiveGroupTypes.Gainer_Foreign: this.tscbTopActiveType.Text = "Gainer - Foreign"; break; case frmStockRanking.ActiveGroupTypes.Loser_Main: this.tscbTopActiveType.Text = "Loser - Main"; break; case frmStockRanking.ActiveGroupTypes.Loser_Foreign: this.tscbTopActiveType.Text = "Loser - Foreign"; break; case frmStockRanking.ActiveGroupTypes.MostSwing_Main: this.tscbTopActiveType.Text = "Most Swing - Main"; break; case frmStockRanking.ActiveGroupTypes.MostSwing_Foreign: this.tscbTopActiveType.Text = "Most Swing - Foreign"; break; } if (this.marketIdTopActive == "S") { this.tscbTopActiveMkt.Text = "SET"; } else { this.tscbTopActiveMkt.Text = "MAI"; } this.intzaTopActive.ClearAllText(); this.intzaTopActive.SortColumnName = this.sortByNameTopActive; this.intzaTopActive.Invalidate(); } catch (Exception ex) { this.ShowError("TopActiveUpdateUIReloadData", ex); } } }
private void TopActiveReloadData(frmStockRanking.ActiveGroupTypes activeGroupType) { base.IsLoadingData = true; this.activeGroupTypeTopActive = activeGroupType; this.TopActiveUpdateUIReloadData(activeGroupType); if (!this.bgwTopActiveLoadData.IsBusy) { this.bgwTopActiveLoadData.RunWorkerAsync(); } }