public void pendingOrderSuspended(Common.Order.OrderType type, string orderId) { if (InvokeRequired) // I'm not in UI thread { BeginInvoke((MethodInvoker) delegate { pendingOrderSuspended(type, orderId); }); // Invoke using an anonymous delegate } else { if (type == Common.Order.OrderType.Purchase) { for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { string id = "" + (long)dataGridView1.Rows[i].Cells[0].Value; if (id.Equals(orderId)) { dataGridView1.Rows[i].Cells[3].Value = "Confirm"; } } } else if (type == Common.Order.OrderType.Selling) { for (int i = 0; i < dataGridView2.Rows.Count - 1; i++) { string id = "" + (long)dataGridView2.Rows[i].Cells[0].Value; if (id.Equals(orderId)) { dataGridView2.Rows[i].Cells[3].Value = "Confirm"; } } } } }
public void pendingOrderNotSuspended(Common.Order.OrderType type, string orderId) { if (InvokeRequired) // I'm not in UI thread { BeginInvoke((MethodInvoker) delegate { pendingOrderNotSuspended(type, orderId); }); // Invoke using an anonymous delegate } else { if (type == Common.Order.OrderType.Purchase) { for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { string id = "" + (long)dataGridView1.Rows[i].Cells[0].Value; if (id.Equals(orderId)) { dataGridView1.Rows[i].Cells[3].Value = ""; client.DeleteOrder(Common.Order.OrderType.Purchase, Int64.Parse(dataGridView1.Rows[i].Cells[0].Value.ToString())); client.AddOrder(Common.Order.OrderType.Purchase, Int64.Parse(dataGridView1.Rows[i].Cells[2].Value.ToString())); return; } } } else if (type == Common.Order.OrderType.Selling) { for (int i = 0; i < dataGridView2.Rows.Count - 1; i++) { string id = "" + (long)dataGridView1.Rows[i].Cells[0].Value; if (id.Equals(orderId)) { dataGridView2.Rows[i].Cells[3].Value = ""; client.DeleteOrder(Common.Order.OrderType.Selling, Int64.Parse(dataGridView2.Rows[i].Cells[0].Value.ToString())); client.AddOrder(Common.Order.OrderType.Selling, Int64.Parse(dataGridView2.Rows[i].Cells[2].Value.ToString())); return; } } } } }
public void pendingOrderNotSuspended(Common.Order.OrderType type, string orderId) { Console.WriteLine("Server wants to unsuspend order: " + orderId + " of type: " + (type == Common.Order.OrderType.Purchase ? "Purchase" : "Selling")); win.pendingOrderNotSuspended(type, orderId); }