Пример #1
0
 private void gridControl1_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right && filter != OrderFilter.Executed)
     {
         int selRows = gridView1.SelectedRowsCount;
         if (selRows > 0)
         {
             int[]        selectRows         = gridView1.GetSelectedRows();
             List <ulong> cancelableOrderIDs = new List <ulong>();
             foreach (int rowID in selectRows)
             {
                 OrderTableObj selected = _orderList[gridView1.GetDataSourceRowIndex(rowID)];
                 if (selected.status == OrderStatus.New || selected.status == OrderStatus.Partial)
                 {
                     cancelableOrderIDs.Add(selected.orderID);
                 }
             }
             if (cancelableOrderIDs.Count > 0)
             {
                 DialogResult result = MessageBox.Show("Cancel " + cancelableOrderIDs.Count + " Orders?", "", MessageBoxButtons.YesNo);
                 if (result == DialogResult.Yes)
                 {
                     foreach (ulong orderID in cancelableOrderIDs)
                     {
                         OnOrderCancel?.Invoke(orderID);
                     }
                 }
             }
         }
     }
 }
Пример #2
0
 public void OnOrderStatusChanged(OrderInfo order, Guid ownerControlGuid)
 {
     if (StatusMatchesFilter(order.status))
     {
         if (filter == OrderFilter.Executed)
         {
             _orderList.Add(new OrderTableObj(order));
         }
         else
         {
             if (_orderDict.ContainsKey(order.orderID))
             {
                 _orderDict[order.orderID].UpdateOrder(order);
             }
             else
             {
                 OrderTableObj obj = new OrderTableObj(order);
                 _orderDict.TryAdd(order.orderID, obj);
                 _orderList.Add(obj);
             }
         }
     }
     else
     {
         OrderTableObj remove;
         if (_orderDict.TryRemove(order.orderID, out remove))
         {
             _orderList.Remove(remove);
         }
     }
 }
Пример #3
0
        public void OnNewOrderAccepted(OrderInfo order, Guid ownerControlGuid)
        {
            OrderTableObj obj = new OrderTableObj(order);

            if (_orderDict.TryAdd(order.orderID, obj))
            {
                _orderList.Add(obj);
            }
        }
Пример #4
0
        private void gridView1_RowCellStyle(object sender, RowCellStyleEventArgs e)
        {
            GridView      view     = sender as GridView;
            OrderTableObj selected = _orderList[gridView1.GetDataSourceRowIndex(e.RowHandle)];

            if (e.Column.Caption.Equals("Side"))
            {
                switch (selected.side)
                {
                case OrderInfo.ESide.BUY:
                    e.Appearance.ForeColor = System.Drawing.Color.Blue;
                    break;

                case OrderInfo.ESide.SELL:
                    e.Appearance.ForeColor = System.Drawing.Color.Red;
                    break;
                }
            }
            else if (e.Column.Caption.Equals("Status"))
            {
                switch (selected.status)
                {
                case OrderStatus.Cancelled:
                    e.Appearance.ForeColor = System.Drawing.Color.Gray;
                    break;

                case OrderStatus.Filled:
                    e.Appearance.ForeColor = System.Drawing.Color.Green;
                    break;

                case OrderStatus.Partial:
                    e.Appearance.ForeColor = System.Drawing.Color.Blue;
                    break;

                case OrderStatus.Rejected:
                    e.Appearance.ForeColor = System.Drawing.Color.Red;
                    break;
                }
            }
        }