예제 #1
0
        private void dgvTrackId_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            foreach (DataGridViewRow myRow in dgvTrackId.Rows)
            {
                if (tabControl.SelectedIndex == 0)
                {
                    MyTestSummary myTrackId = (MyTestSummary)myRow.DataBoundItem;

                    if (myTrackId.FilePath.Contains("PASS"))
                    {
                        myRow.DefaultCellStyle.ForeColor = Color.Green;
                    }
                    else
                    {
                        myRow.DefaultCellStyle.ForeColor = Color.Red;
                    }
                }
                else
                {
                    MyTestResult myTestResult = (MyTestResult)myRow.DataBoundItem;

                    if (myTestResult.FilePath.Contains("PASS"))
                    {
                        myRow.DefaultCellStyle.ForeColor = Color.Green;
                    }
                    else
                    {
                        myRow.DefaultCellStyle.ForeColor = Color.Red;
                    }
                }
            }
        }
예제 #2
0
        private void dgvTrackId_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (tabControl.SelectedIndex == 0)
            {
                try
                {
                    MyTestSummary tid = (MyTestSummary)dgvTrackId.Rows[e.RowIndex].DataBoundItem;

                    if (tid != null)
                    {
                        rTxtBox.BackColor = tid.FilePath.Contains("PASS") ? rTxtBox.BackColor = Color.DarkGreen : rTxtBox.BackColor = Color.DarkRed;
                        rTxtBox.Text      = File.ReadAllText(tid.FilePath);
                    }
                }
                catch (Exception)
                {
                    rTxtBox.Text = rm.GetString("uiCantReadTrackidFile");
                }
            }
            else
            {
                try
                {
                    MyTestResult tr = (MyTestResult)dgvTrackId.Rows[e.RowIndex].DataBoundItem;

                    if (tr != null)
                    {
                        string json = File.ReadAllText(tr.FilePath);
                        tr.MyTestResultList = TestCaseBase.ToObject(json);

                        bindingListTestResult.Clear();

                        foreach (var item in tr.MyTestResultList)
                        {
                            bindingListTestResult.Add(item);
                        }

                        dgvTestResult.DataSource = null;
                        dgvTestResult.DataSource = bindingListTestResult;
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }