public void ShowCognexQuickBuildPart(ToolBlockPowerSuite ThisToolBlockPowerSuite)
        {
            PatternForm frm = new PatternForm();

            frm.PrepareToolBlockEditor(frm.editDapter, ThisToolBlockPowerSuite.ThisToolBlock, ThisToolBlockPowerSuite.ThisToolBlock, ThisToolBlockPowerSuite.VppName);
            frm.FormClosed += delegate
            {
                frm.Dispose();
            };
            frm.Show();
        }
 public void RanToolBlock(ToolBlockPowerSuite toolBlockPowerSuite, Canvas cnv, Cognex.VisionPro.ICogRecord irc, object Outputs)
 {
     cnv.Display(irc);
     if (toolBlockPowerSuite.Passed)
     {
         OKOccured(toolBlockPowerSuite, cnv, irc, Outputs);
     }
     else
     {
         App.nNGNum++;
         string NGDescription = NGOccured(toolBlockPowerSuite, cnv, irc, Outputs);
         new Thread((ThreadStart) delegate
         {
             CaptureCurrentImage(toolBlockPowerSuite, NGDescription);
         }).Start();
     }
 }
        private void CaptureCurrentImage(ToolBlockPowerSuite toolBlockPowerSuite, string strDscription = null)
        {
            Cognex.VisionPro.ICogImage cogImage = null;
            try
            {
                cogImage = (toolBlockPowerSuite.ThisToolBlock.Inputs[0].Value as Cognex.VisionPro.ICogImage);
            }
            catch
            {
                try
                {
                    cogImage = (toolBlockPowerSuite.ThisToolBlock.Tools[0] as CogAcqFifoTool).OutputImage;
                }
                catch
                {
                }
            }
            Bitmap bmp = cogImage.ToBitmap();

            AutoSaveClearImage(bmp, strDscription, false, "图片", null);
        }
 public virtual void Run(ToolBlockPowerSuite toolBlockPowerSuite, bool Lockable = false, params object[] Inputs)
 {
     if (!Lockable)
     {
         toolBlockPowerSuite.Run(RanToolBlock, Inputs);
         App.nTodayImageCount++;
         new Thread((ThreadStart) delegate
         {
             UnitDB compactDB3 = base.CompactDB;
             string manufatureTotalNumRecordTable_PerDay2 = App.ManufatureTotalNumRecordTable_PerDay;
             DateTime now2 = DateTime.Now;
             compactDB3.Write(manufatureTotalNumRecordTable_PerDay2, now2.ToString("yyyy-MM-dd"), App.nTodayImageCount.ToString());
             UnitDB compactDB4 = base.CompactDB;
             string nGNumRecordTable_PerDay2 = App.NGNumRecordTable_PerDay;
             now2 = DateTime.Now;
             compactDB4.Write(nGNumRecordTable_PerDay2, now2.ToString("yyyy-MM-dd"), App.nNGNum.ToString());
             DoRefreshManufatureIndicators();
         }).Start();
     }
     else
     {
         lock (LockSoftwareTrigger)
         {
             toolBlockPowerSuite.Run(RanToolBlock, Inputs);
             App.nTodayImageCount++;
             new Thread((ThreadStart) delegate
             {
                 UnitDB compactDB = base.CompactDB;
                 string manufatureTotalNumRecordTable_PerDay = App.ManufatureTotalNumRecordTable_PerDay;
                 DateTime now = DateTime.Now;
                 compactDB.Write(manufatureTotalNumRecordTable_PerDay, now.ToString("yyyy-MM-dd"), App.nTodayImageCount.ToString());
                 UnitDB compactDB2 = base.CompactDB;
                 string nGNumRecordTable_PerDay = App.NGNumRecordTable_PerDay;
                 now = DateTime.Now;
                 compactDB2.Write(nGNumRecordTable_PerDay, now.ToString("yyyy-MM-dd"), App.nNGNum.ToString());
                 DoRefreshManufatureIndicators();
             }).Start();
         }
     }
 }
 private void OKOccured(ToolBlockPowerSuite toolBlockPowerSuite, Canvas cnv, Cognex.VisionPro.ICogRecord irc, object Outputs)
 {
     //cnv.DisplayText(1, text);
 }
 private string NGOccured(ToolBlockPowerSuite toolBlockPowerSuite, Canvas cnv, Cognex.VisionPro.ICogRecord irc, object Outputs)
 {
     return("未找到特征");
 }