コード例 #1
0
        private void InitDataGrid()
        {
            List <Item> tmpItems = ItemManager.GetItemManager().GetItems();

            if (tmpItems.Count > 0)
            {
                items.Clear();
                MainDataGridView.Rows.Clear();
                foreach (Item item in tmpItems)
                {
                    if (item.NeedTest)
                    {
                        items.Add(item);
                        DataGridViewRow viewRow = new DataGridViewRow();
                        //序号
                        DataGridViewTextBoxCell indexCell = new DataGridViewTextBoxCell();
                        indexCell.Value = item.Index;
                        viewRow.Cells.Add(indexCell);
                        //名称
                        DataGridViewTextBoxCell nameCell = new DataGridViewTextBoxCell();
                        nameCell.Value = item.ItemName;
                        viewRow.Cells.Add(nameCell);
                        //进度
                        DataGridViewProgressBarCell progressCell = new DataGridViewProgressBarCell();
                        progressCell.Value = 0;
                        viewRow.Cells.Add(progressCell);
                        //结果
                        DataGridViewTextBoxCell resultCell = new DataGridViewTextBoxCell();
                        viewRow.Cells.Add(resultCell);
                        //时间
                        DataGridViewTextBoxCell timeCell = new DataGridViewTextBoxCell();
                        viewRow.Cells.Add(timeCell);
                        MainDataGridView.Rows.Add(viewRow);
                    }
                }
                MainDataGridView.ClearSelection();
            }
            else
            {
                MessageBox.Show("无法加载测试项,请检查配置文件");
            }
        }
コード例 #2
0
 private void OnStart()
 {
     UpdateState(StateCode.STATE_TESTING);
     for (int i = 0; i < MainDataGridView.Rows.Count; i++)
     {
         DataGridViewTextBoxCell     indexCell    = (DataGridViewTextBoxCell)MainDataGridView.Rows[i].Cells[0];
         DataGridViewTextBoxCell     nameCell     = (DataGridViewTextBoxCell)MainDataGridView.Rows[i].Cells[1];
         DataGridViewProgressBarCell progressCell = (DataGridViewProgressBarCell)MainDataGridView.Rows[i].Cells[2];
         DataGridViewTextBoxCell     resultCell   = (DataGridViewTextBoxCell)MainDataGridView.Rows[i].Cells[3];
         DataGridViewTextBoxCell     timeCell     = (DataGridViewTextBoxCell)MainDataGridView.Rows[i].Cells[4];
         indexCell.Style.ForeColor  = SystemColors.WindowText;
         nameCell.Style.ForeColor   = SystemColors.WindowText;
         progressCell.Value         = 0;
         resultCell.Value           = "";
         resultCell.Style.ForeColor = SystemColors.WindowText;
         timeCell.Value             = "";
         timeCell.Style.ForeColor   = SystemColors.WindowText;
     }
     MainDataGridView.FirstDisplayedScrollingRowIndex = 0;
     testStartTime     = DateTime.Now;
     TimeLabel.Text    = string.Format("{0:00} : {1:00} . {2:000}", 0, 0, 0);
     TestTimer.Enabled = true;
     LogTextBox.Text   = "";
 }
コード例 #3
0
        private void UpdateProgress(int index, int value)
        {
            DataGridViewProgressBarCell cell = (DataGridViewProgressBarCell)MainDataGridView.Rows[index].Cells[2];

            cell.Value = value;
        }