Пример #1
0
        private void AddShellCommand_Click(object sender, System.EventArgs e)
        {
            var count = scrollableControlShellCommand.Controls.Count;
            var shellCommandControl = new ShellCommandControl(_testEditorControl, string.Empty);

            scrollableControlShellCommand.Controls.Add(shellCommandControl);
            scrollableControlShellCommand.Controls.SetChildIndex(shellCommandControl, count);
            shellCommandControl.Dock           = DockStyle.Top;
            shellCommandControl.ConfigChanged += onConfigChanged;
            timer.Enabled = true;
        }
Пример #2
0
        private void timer_Tick(object sender, System.EventArgs e)
        {
            var valid    = true;
            var errorMsg = new StringBuilder();

            for (var idx = scrollableControlShellCommand.Controls.Count - 1; idx >= 0; --idx)
            {
                ShellCommandControl shellCommandControl = scrollableControlShellCommand.Controls[idx] as ShellCommandControl;
                shellCommandControl.BackColor = Color.Transparent;
                if (string.IsNullOrEmpty(shellCommandControl.command))
                {
                    errorMsg = errorMsg.Append("Please input your command.  ");
                    valid    = false;
                    this._testEditorControl.AllowToRun(false);
                    shellCommandControl.BackColor = Color.Pink;
                    EditorForm.ShowMessage(errorMsg.ToString(), true);
                }
                if (_test.IsShellCommandExist(shellCommandControl.command))
                {
                    valid = false;
                    shellCommandControl.BackColor = Color.Pink;
                    errorMsg.Append(string.Format("The command [{0}] already exists, please resolve the duplicate.   ", shellCommandControl.command));
                }
                else if (!string.IsNullOrEmpty(shellCommandControl.command.Trim()))
                {
                    valid &= true;
                    this.DoDataExchange();
                }
            }
            for (var idx = scrollableControlExpectedData.Controls.Count - 1; idx >= 0; --idx)
            {
                ExpectedDataControl expectedDataControl = scrollableControlExpectedData.Controls[idx] as ExpectedDataControl;
                expectedDataControl.BackColor = Color.Transparent;
                ExpectedData data = expectedDataControl.expectedData;
                if (string.IsNullOrEmpty(data.name) || string.IsNullOrEmpty(data.value))
                {
                    errorMsg.Append("Please input your expected data.  ");
                    valid &= false;
                    expectedDataControl.BackColor = Color.Pink;
                }
                if (_test.IsExpectedDataExist(data.name))
                {
                    valid &= false;
                    errorMsg.Append(string.Format("The expected data [{0}] already exists, please resolve the duplicate.   ", data.name));
                    expectedDataControl.BackColor = Color.Pink;
                }
                else if (!string.IsNullOrEmpty(data.value.Trim()))
                {
                    valid &= true;
                    this.DoDataExchange();
                }
            }
            if (!valid)
            {
                EditorForm.ShowMessage(errorMsg.ToString(), true);
                this._testEditorControl.AllowToRun(false);
            }
            else
            {
                timer.Enabled = false;
            }
            if (null != EditorForm)
            {
                EditorForm.ShowMessage(errorMsg.ToString(), !valid);
                this._testEditorControl.AllowToRun(valid);
            }
        }
Пример #3
0
 private void _updateUI()
 {
     timer.Enabled = false;
     if (_test != null)
     {
         textTestId.Text            = _test.testid;
         richTextObjective.Text     = _test.objective;
         richTextPassFail.Text      = _test.passFailCreterial;
         richTextTestSetup.Text     = _test.TestSetup;
         richTextTestProcedure.Text = _test.testProcedure;
         scrollableControlShellCommand.Controls.Clear();
         var commandControlList = new List <ShellCommandControl>();
         foreach (var c in _test.shellCommand)
         {
             var itr = c.GetEnumerator();
             while (itr.MoveNext())
             {
                 var shellCommandControl = new ShellCommandControl(_testEditorControl, itr.Current.Value);
                 shellCommandControl.ConfigChanged += onConfigChanged;
                 commandControlList.Insert(0, shellCommandControl);
             }
         }
         foreach (var control in commandControlList)
         {
             scrollableControlShellCommand.Controls.Add(control);
             control.Dock = DockStyle.Top;
         }
         scrollableControlExpectedData.Controls.Clear();
         var expControlList = new List <ExpectedDataControl>();
         foreach (var d in _test.expecteddata)
         {
             var idx      = 1;
             var dataName = string.Empty;
             var itr      = d.GetEnumerator();
             while (itr.MoveNext())
             {
                 if (idx % 2 == 0)
                 {
                     var expectedDataControl = new ExpectedDataControl(_testEditorControl, new ExpectedData(dataName, itr.Current.Value));
                     expectedDataControl.ConfigChanged += onConfigChanged;
                     expControlList.Insert(0, expectedDataControl);
                 }
                 else
                 {
                     dataName = itr.Current.Value;
                 }
                 idx += 1;
             }
         }
         foreach (var control in expControlList)
         {
             scrollableControlExpectedData.Controls.Add(control);
             control.Dock = DockStyle.Top;
         }
         rPowerCycleFalse.Checked    = !_test.powercycle;
         rPowerCycleTrue.Checked     = _test.powercycle;
         rSkipFalse.Checked          = !_test.skip;
         rSkipTrue.Checked           = _test.skip;
         rWaitKeystrokeFalse.Checked = !_test.waitkeystroke;
         rWaitKeystrokeTrue.Checked  = _test.waitkeystroke;
     }
 }