コード例 #1
0
ファイル: ResultList.cs プロジェクト: sahilagnihotri/Chess
        private void SetRun(TaskRunEntity run)
        {
            // Clear everything first
            suspend_selection_notify = true;
            dataGridView1.Rows.Clear();
            rowmap.Clear();
            resultmap.Clear();

            TestRunEntity testRun = run as TestRunEntity;

            if (testRun != null && testRun.Result != null)
            {
                var  results  = testRun.Result.GetChessResults();
                bool clearSel = false;
                foreach (var result in results)
                {
                    string label = result.Label;
                    resultmap[label] = result;
                    //bool hasschedule = result.DataElement.Element(XNames.Schedule) != null;
                    //bool hastrace = run.Entity.TaskHandle.GetTraceFile() != null;
                    int             newrow = dataGridView1.Rows.Add(result.Label, result.Description);
                    DataGridViewRow row    = dataGridView1.Rows[newrow];
                    rowmap[label] = row;
                    row.Cells[1].Style.ForeColor = result.ResultType.GetDisplayColor();
                }
                if (clearSel)
                {
                    dataGridView1.ClearSelection();
                }
            }

            _testRun = testRun;
            suspend_selection_notify = false;
        }
コード例 #2
0
ファイル: BoundRunItem.cs プロジェクト: sahilagnihotri/Chess
        public BoundRunItem(TaskRunEntity run)
        {
            Run = run;

            // Bind the text now since it won't ever change
            DisplayText = run.DisplayName ?? run.MenuItemTypeName();

            Run.Task.StatusChanged += Run_StatusChangeEvt;
            Update();
        }
コード例 #3
0
        internal void EnsureTaskHandleCreated(TaskRunEntity run)
        {
            if (run.Task != null)
            {
                return;
            }

            // Re-create the task from the run entity
            AppTask task = AppTaskBuilder.BuildTaskFromRun(run);

            run.Task = task;
        }
コード例 #4
0
        private void dataGridView1_SelectionChanged(object sender, EventArgs e)
        {
            if (suppress_selection_notify)
            {
                return;
            }

            suppress_selection_notify = true;

            try
            {
                // Reset the back color for the previously selected rows
                foreach (var row in _selectedRows)
                {
                    row.DefaultCellStyle.BackColor = dataGridView1.DefaultCellStyle.BackColor;
                }
                _selectedRows.Clear();

                DataGridViewSelectedRowCollection selection = dataGridView1.SelectedRows;
                if (selection.Count == 1)
                {
                    DataGridViewRow row = selection[0];
                    _selectedRows.Add(row);
                    int           taskID = (int)row.Cells[0].Value;
                    TaskRunEntity run    = model.runs[taskID];
                    model.selection.Update(this, run);
                }
                else if (selection.Count > 1)
                {
                    List <TaskRunEntity> selectedEntities = new List <TaskRunEntity>();
                    foreach (DataGridViewRow row in selection)
                    {
                        _selectedRows.Add(row);
                        int           taskID = (int)row.Cells[0].Value;
                        TaskRunEntity run    = model.runs[taskID];
                        selectedEntities.Add(run);
                    }
                    model.selection.Update(this, selectedEntities);
                }

                foreach (var row in _selectedRows)
                {
                    row.DefaultCellStyle.BackColor = InactiveSelectionBackColor;
                }
            }
            finally
            {
                suppress_selection_notify = false;
            }
        }
コード例 #5
0
        public static AppTask BuildTaskFromRun(TaskRunEntity run)
        {
            var xtaskState = run.DataElement.Element(XSessionNames.TaskState);

            if (xtaskState == null)
            {
                throw new ArgumentException("The run doesn't have a TaskState child element.");
            }

            string typeName = (string)xtaskState.Attribute(XSessionNames.AType);
            Type   taskType = Type.GetType(typeName);

            if (taskType == null)
            {
                throw new ArgumentException("Could not find the task type: " + typeName);
            }
            if (!typeof(AppTask).IsAssignableFrom(taskType))
            {
                throw new ArgumentException(String.Format("The run's task type {0} must inherit from {1}.", taskType.Name, typeof(AppTask).Name));
            }

            // Try to find a constructor that takes a run entity
            Type runType    = run.GetType();
            var  validCtors = (from ctor in taskType.GetConstructors()
                               let parameters = ctor.GetParameters()
                                                where parameters.Length == 1
                                                where parameters[0].ParameterType.IsAssignableFrom(runType)
                                                select ctor)
                              .ToArray();

            if (validCtors.Length == 0)
            {
                throw new ArgumentException(String.Format("Could not create task of type {0} because a constructor that accepts a {1} doesn't exist or is not visible from the MCUT.Execution assembly.", taskType.Name, typeof(TaskRunEntity).Name));
            }
            if (validCtors.Length > 1)
            {
                throw new ArgumentException(String.Format("Could not create task of type {0} because more than one constructor accepts a {1} as its only parameter.", taskType.Name, typeof(TaskRunEntity).Name));
            }
            var ctorInfo = validCtors[0];

            return((AppTask)ctorInfo.Invoke(new[] { run }));
        }
コード例 #6
0
        private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            // If clicking the header row, than we won't have a data row.
            if (e.RowIndex == -1)
            {
                return;
            }

            DataGridViewRow row    = dataGridView1.Rows[e.RowIndex];
            int             taskID = (int)row.Cells[0].Value;
            TaskRunEntity   run    = model.runs[taskID];

            //DataGridViewCell cell = row.Cells[e.ColumnIndex];

            if (e.Button == MouseButtons.Left)
            {
                // If the entity is already highlighted
                // but not in the model.selection context, then force
                // it to be selected
                if (row.Selected && model.selection.current.SelectedEntity != run)
                {
                    suppress_selection_notify = true;
                    try
                    {
                        model.selection.Update(this, run);
                    }
                    finally
                    {
                        suppress_selection_notify = false;
                    }
                }
            }
            else if (e.Button == MouseButtons.Right)
            {
                PopupMenu.ShowContextMenu(contextMenuStrip1, run);
            }
        }
コード例 #7
0
ファイル: BottomTabs.cs プロジェクト: sahilagnihotri/Chess
        void ChangeRun(TaskRunEntity run)
        {
            string outfile = null;
            string errfile = null;

            if (run != null)
            {
                var scriptTask = run.Task as AppScriptProcessTask;
                if (scriptTask != null)
                {
                    outfile = scriptTask.OutputFilePath;
                    errfile = scriptTask.ErrorFilePath;
                }
            }

            stdOutputStreamBox.FilePath = outfile;
            stdErrorStreamBox.FilePath  = errfile;
            if (tabcontrol1.SelectedTab == tabpgTaskresults)
            {
                RefreshRun();
            }
            current_run = run;
            BindErrorTab();
        }