Ejemplo n.º 1
0
 private void DoTest()
 {
     try
     {
         DeleteSource();
         pictureBox1.Enabled = false;
         splashScreenManager1.ShowWaitForm();
         //splashScreenManager1.SetWaitFormCaption("校检测试仪并开始测试");
         //splashScreenManager1.SetWaitFormDescription(" 请等待。。。");
         bool start = false;
         suspend = false;
         pro     = new Thread(DoProgress);
         pro.Start();
         Task.Factory.StartNew(() =>
         {
             start   = StartTool();
             suspend = true;
         }).ContinueWith(x =>
         {
             if (!start)
             {
                 this.Invoke((MethodInvoker)(() =>
                 {
                     killP();
                     pro.Abort();
                     //MessageBox.Show("came");
                     FrmInfo.Instance.checkWaitedSource();
                     FrmInfo.Instance.Show();
                     splashScreenManager1.CloseWaitForm();
                     XtraMessageBox.Show("报告数据处理失败,本次数据没有上传,请稍后重新上传数据或重新检测!", "错误");
                     this.Close();
                 }));
             }
             else
             {
                 this.Invoke((MethodInvoker)(() =>
                 {
                     this.pictureBox1.Enabled = true;
                     FrmFinish frmFinish = new FrmFinish();
                     frmFinish.Show();
                     pro.Abort();
                     splashScreenManager1.CloseWaitForm();
                     this.Close();
                 }));
             }
         });
     }
     catch (Exception ex)
     {
         LogHelper.WriteLog(ex.ToString());
     }
 }
Ejemplo n.º 2
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            DeleteSource();
            pictureBox1.Enabled = false;
            splashScreenManager1.ShowWaitForm();
            //splashScreenManager1.SetWaitFormCaption("校检测试仪并开始测试");
            //splashScreenManager1.SetWaitFormDescription(" 请等待。。。");
            bool start = false;

            suspend = false;
            pro     = new Thread(DoProgress);
            pro.Start();
            Task.Factory.StartNew(() =>
            {
                start   = StartTool();
                suspend = true;
            }).ContinueWith(x =>
            {
                if (!start)
                {
                    killP();
                    FrmInfo.Instance.Show();
                    this.Close();
                }
                else
                {
                    // splashScreenManager1.CloseWaitForm();
                    this.Invoke((MethodInvoker)(() =>
                    {
                        //splashScreenManager1.SendCommand(WaitForm1.WaitFormCommand.SetProgress, 100);
                        this.pictureBox1.Enabled = true;
                        //splashScreenManager1.CloseWaitForm();
                        //FrmMain.Instance.XtraTabOpen("FrmFinish", "信息");
                        //FrmFinish frmFinish = new FrmFinish();
                        FrmFinish frmFinish = new FrmFinish();
                        frmFinish.Show();
                        pro.Abort();
                        splashScreenManager1.CloseWaitForm();
                        this.Close();
                    }));
                }
            });
        }