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);
            }
        }
Ejemplo n.º 2
0
 protected virtual void OnStockInfoUpdated(StockInfoUpdateEventArgs e)
 {
     if (handleStockInfoUpdated != null)
     {
         handleStockInfoUpdated(this, e);
     }
 }