Пример #1
0
        void process_OutputDataReceived2(object sender, DataReceivedEventArgs e)
        {
            if (this.InvokeRequired)
            {
                OutputDataReceivedCallback d = new OutputDataReceivedCallback(process_OutputDataReceived2);
                this.Invoke(d, new object[] { sender, e });
            }
            else
            {
                AddNewLine(e.Data);

                if (e.Data != null && e.Data.StartsWith("$$"))
                {
                    // this is test output data
                    // format is $$OK|FAIL compoenent-name
                    // format also $$END
                    string msg = e.Data;
                    if (msg.StartsWith("$$FAIL"))
                    {
                        resetprocess.Kill();
                        resetprocess = null;
                        OnFinished(Status.Fail);
                    }
                    else if (msg.StartsWith("$$OK "))
                    {
                        ValidateCurrent(msg);
                    }
                    else if (msg.StartsWith("$$END"))
                    {
                        resetprocess.Kill();
                        resetprocess = null;
                        // check every item is passed
                        bool sucessful = true;
                        foreach (Control c in groupBox1.Controls)
                        {
                            CheckBox cb = c as CheckBox;
                            if (cb == null)
                            {
                                continue;
                            }

                            if (!cb.Checked)
                            {
                                sucessful = false;
                                break;
                            }
                        }
                        if (sucessful)
                        {
                            OnFinished(Status.TestFinish);
                        }
                        else
                        {
                            OnFinished(Status.Fail);
                        }
                    }
                }
            }
        }
Пример #2
0
 void process_OutputDataReceived(object sender, DataReceivedEventArgs e)
 {
     if (this.InvokeRequired)
     {
         OutputDataReceivedCallback d = new OutputDataReceivedCallback(process_OutputDataReceived);
         this.Invoke(d, new object[] { sender, e });
     }
     else
     {
         AddNewLine(e.Data);
     }
 }