public static bool CollectImage(IWin32Window _owner, int Tex, int nCount)
 {
     owner = _owner;
     if (UDPProc.UDPCommand_01() == null)
     {
         MessageBox.Show(owner, "与采集板通信失败");
         return(false);
     }
     while (true)
     {
         ccdImageList      = new List <ccdImage>(nCount);
         ccdImageRxConfirm = new List <bool>(nCount);
         for (int i = 0; i < nCount; i++)
         {
             ccdImageList.Add(new ccdImage());
             ccdImageRxConfirm.Add(false);
         }
         if (UDPCommand_02(Tex, nCount) == null)
         {
             MessageBox.Show(owner, "与采集板通信失败");
             return(false);
         }
         if (nCount < 3)
         {
             wp = null;
             WaitingImageList(oImage);
         }
         else
         {
             wp             = new WaitingProc(owner);
             wp.MaxProgress = nCount;
             WaitingProcFunc wpf = new WaitingProcFunc(WaitingImageList);
             wp.Execute(wpf, "图像采集中", WaitingType.None, "是否取消?");
         }
         bool bok = true;
         for (int i = 0; i < nCount; i++)
         {
             if (ccdImageRxConfirm[i] == false)
             {
                 bok = false;
                 break;
             }
         }
         if (bok)
         {
             return(true);
         }
         else
         {
             if (MessageBox.Show("图像采集失败,是否重试", "图像采集失败", MessageBoxButtons.RetryCancel) == DialogResult.Retry)
             {
                 return(false);
             }
         }
     }
 }
Esempio n. 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            SystemParam.CCD_M   = (int)nCCD_M.Value;
            SystemParam.CCD_N   = (int)nCCD_N.Value;
            SystemParam.CCD_phi = cbCCD_phi.SelectedIndex;
            SystemParam.CCD_PGA = cbCCD_PGA.SelectedIndex;
            DeviceState ds = UDPProc.UDPCommand_01();

            if (ds == null)
            {
                MessageBox.Show("设置失败");
            }
            else
            {
                MessageBox.Show("设置成功");
            }
        }