Exemplo n.º 1
0
        private void SetTaskDataSource(ArbitrageTaskGroup taskGroup)
        {
            BindingList <ArbitrageSubTaskViewModel> list = new BindingList <ArbitrageSubTaskViewModel>();

            if (taskGroup != null && taskGroup.TaskList != null)
            {
                foreach (ArbitrageTask task in taskGroup.TaskList)
                {
                    ArbitrageSubTaskViewModel firstTaskVm = new ArbitrageSubTaskViewModel()
                    {
                        TaskId       = task.TaskId,
                        OrderSide    = task.FirstSubTask.OrderSide,
                        Instrument   = task.FirstSubTask.Instrument,
                        PlanOrderQty = task.FirstSubTask.PlanOrderQty,
                        OrderQty     = task.FirstSubTask.OrderQty,
                        TradeQty     = task.FirstSubTask.TradeQty
                    };
                    list.Add(firstTaskVm);

                    ArbitrageSubTaskViewModel secondTaskVm = new ArbitrageSubTaskViewModel()
                    {
                        TaskId       = task.TaskId,
                        OrderSide    = task.SecondSubTask.OrderSide,
                        Instrument   = task.SecondSubTask.Instrument,
                        PlanOrderQty = task.SecondSubTask.PlanOrderQty,
                        OrderQty     = task.SecondSubTask.OrderQty,
                        TradeQty     = task.SecondSubTask.TradeQty
                    };
                    list.Add(secondTaskVm);
                }
            }

            this.gridTask.DataSource = list;
        }
Exemplo n.º 2
0
        private void gridTask_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }

            ArbitrageSubTaskViewModel model = this.gridTask.Rows[e.RowIndex].DataBoundItem as ArbitrageSubTaskViewModel;

            if (model.TaskId % 2 == 0)
            {
                e.CellStyle.BackColor = Color.LightBlue;
            }
            else
            {
                e.CellStyle.BackColor = Color.White;
            }
        }