Example #1
0
 /**
  * Update the DataGridView based on the given ExecutionReport, thread-safe
  */
 public void update(QuickFix44.ExecutionReport report)
 {
     if (grdOrders.InvokeRequired)
     {
         updateCallback1 d = new updateCallback1(update);
         this.Invoke(d, new object[] { report });
     }
     else
     {
         String reportID = report.getOrderID().getValue();
         // if the order is already in the DataGridView
         if (orderMap.ContainsKey(reportID))
         {
             // update the cells with the values that changed
             DataGridViewRow row = grdOrders.Rows[orderMap[reportID]];
             row.Cells["Status"].Value = report.getString(9051); // FXCMOrdStatus
             row.Cells["Open"].Value   = report.getPrice().getValue();
             // scroll to the updated row
             grdOrders.CurrentCell = grdOrders[0, orderMap[reportID]];
         }
         else // otherwise add it to the DataGridView
         {
             orderMap.Add(reportID, orderMap.Count);
             grdOrders.Rows.Add(
                 report.getAccount().getValue(),
                 report.getString(9051), // FXCMOrdStatus
                 reportID,
                 report.getSymbol().getValue(),
                 report.getOrderID().getValue(),
                 report.getPrice().getValue()
                 );
             // scroll to the added row
             grdOrders.CurrentCell = grdOrders[0, orderMap.Count - 1];
         }
         // force the interface to refresh
         Application.DoEvents();
     }
 }