void Instance_handleStockInfoUpdated(object sender, StockInfoUpdateEventArgs e) { try { new Thread((ThreadStart) delegate() { this.BeginInvoke((ThreadStart) delegate() { try { int i = AllRealTimePositions.Find("Cusip", e.StockInfo.Cusip); if (i != -1) { //update the stock AllRealTimePositions[i].Ticker = e.StockInfo.Ticker; AllRealTimePositions[i].Company = e.StockInfo.Name; } dgvRealTimePosition.Refresh(); } catch (Exception ex) { Trace.WriteLine(ex, TraceEnum.LoggedError); } }); }).Start(); } catch (Exception ex) { Trace.WriteLine(ex, TraceEnum.LoggedError); } }
protected virtual void OnStockInfoUpdated(StockInfoUpdateEventArgs e) { if (handleStockInfoUpdated != null) { handleStockInfoUpdated(this, e); } }