Example #1
1
 public bool init(string vpppath, CogRecordDisplay cogRecordDisplayin = null)
 {
     if (null == vpppath)
     {
         return false;
     }
     try
     {
         myJobManager = (CogJobManager)CogSerializer.LoadObjectFromFile(vpppath);
         myJob = myJobManager.Job(0);
         myJobIndependent = myJob.OwnedIndependent;
         myJobManager.UserQueueFlush();
         myJobManager.FailureQueueFlush();
         myJob.ImageQueueFlush();
         myJobIndependent.RealTimeQueueFlush();
         updateDisplaySource(cogRecordDisplayin);
     }
     catch { }
     return true;
 }
Example #2
1
 public bool init0(string vpppath0, CogRecordDisplay cogRecordDisplayin0 = null)
 {
     updateDisplaySource0(cogRecordDisplayin0);
     if (null == vpppath0)
     {
         return false;
     }
     try
     {
         myJobManager0 = (CogJobManager)CogSerializer.LoadObjectFromFile(vpppath0);
         myJob0 = myJobManager0.Job(0);
         myJobIndependent0 = myJob0.OwnedIndependent;
         myJobManager0.UserQueueFlush();
         myJobManager0.FailureQueueFlush();
         myJob0.ImageQueueFlush();
         myJobIndependent0.RealTimeQueueFlush();
     }
     catch
     {
         return false;
     }
     return true;
 }
Example #3
0
 /// <summary>
 /// 关闭
 /// </summary>
 public bool Close()
 {
     if (null != myJobManager)
     {
         try
         {
             myJob.Reset();
             myJobManager.Stop();
             myJobManager.Shutdown();
             myJob = null;
             myJobManager = null;
             myJobIndependent = null;
             Imagein.Dispose();
             return true;
         }
         catch
         {
             return false;
         }
         GC.Collect();
     }
     else
     {
         return false;
     }
 }
Example #4
0
 public bool Close()
 {
     bool closeS1 = false;
     bool closeS2 = false;
     bool closeS3 = false;
     bool closeS4 = false;
     if (null != myJobManager0)
     {
         try
         {
             myJob0.Reset();
             myJobManager0.Stop();
             myJobManager0.Shutdown();
             myJob0 = null;
             myJobManager0 = null;
             myJobIndependent0 = null;
             closeS1 = true;
         }
         catch
         {}
     }
     else
     {
         closeS1 = false;
     }
     if (null != myJobManager1)
     {
         try
         {
             myJob1.Reset();
             myJobManager1.Stop();
             myJobManager1.Shutdown();
             myJob1 = null;
             myJobManager1 = null;
             myJobIndependent1 = null;
             closeS2 = true;
         }
         catch
         {}
     }
     else
     {
         closeS2 = false;
     }
     if (null != myJobManager2)
     {
         try
         {
             myJob2.Reset();
             myJobManager2.Stop();
             myJobManager2.Shutdown();
             myJob2 = null;
             myJobManager2 = null;
             myJobIndependent2 = null;
             closeS3 = true;
         }
         catch
         {}
     }
     else
     {
         closeS3 = false;
     }
     if (null != myJobManager3)
     {
         try
         {
             myJob3.Reset();
             myJobManager3.Stop();
             myJobManager3.Shutdown();
             myJob3 = null;
             myJobManager3 = null;
             myJobIndependent3 = null;
             closeS4= true;
         }
         catch
         {}
     }
     else
     {
         closeS4 = false;
     }
     GC.Collect();
     if (closeS1 == true && closeS2 == true && closeS3 == true && closeS4 == true)
     {
         return true;
     }
     else
     {
         return false;
     }
 }
Example #5
0
 public bool init1(string vpppath1, CogRecordDisplay cogRecordDisplayin1 = null)
 {
     updateDisplaySource1(cogRecordDisplayin1);
     if (null == vpppath1)
     {
         return false;
     }
     try
     {
         myJobManager1 = (CogJobManager)CogSerializer.LoadObjectFromFile(vpppath1);
         myJob1 = myJobManager1.Job(0);
         myJobIndependent1 = myJob1.OwnedIndependent;
         myJobManager1.UserQueueFlush();
         myJobManager1.FailureQueueFlush();
         myJob1.ImageQueueFlush();
         myJobIndependent1.RealTimeQueueFlush();
     }
     catch
     {
         return false;
     }
     return true;
 }
Example #6
0
 public bool init3(string vpppath3, CogRecordDisplay cogRecordDisplayin3 = null)
 {
     updateDisplaySource3(cogRecordDisplayin3);
     if (null == vpppath3)
     {
         return false;
     }
     try
     {
         myJobManager3 = (CogJobManager)CogSerializer.LoadObjectFromFile(vpppath3);
         myJob3 = myJobManager3.Job(0);
         myJobIndependent3 = myJob3.OwnedIndependent;
         myJobManager3.UserQueueFlush();
         myJobManager3.FailureQueueFlush();
         myJob3.ImageQueueFlush();
         myJobIndependent3.RealTimeQueueFlush();
     }
     catch
     {
         return false;
     }
     return true;
 }
Example #7
0
 public bool init2(string vpppath2, CogRecordDisplay cogRecordDisplayin2 = null)
 {
     updateDisplaySource2(cogRecordDisplayin2);
     if (null == vpppath2)
     {
         return false;
     }
     try
     {
         myJobManager2 = (CogJobManager)CogSerializer.LoadObjectFromFile(vpppath2);
         myJob2 = myJobManager2.Job(0);
         myJobIndependent2 = myJob2.OwnedIndependent;
         myJobManager2.UserQueueFlush();
         myJobManager2.FailureQueueFlush();
         myJob2.ImageQueueFlush();
         myJobIndependent2.RealTimeQueueFlush();
     }
     catch
     {
         return false;
     }
     return true;
 }
Example #8
0
 public bool init(string vpppath0,string vpppath1, string vpppath2, CogRecordDisplay cogRecordDisplayin0 = null, CogRecordDisplay cogRecordDisplayin1 = null, CogRecordDisplay cogRecordDisplayin2 = null)
 {
     bool initS1 = false;
     bool initS2 = false;
     bool initS3 = false;
     updateDisplaySource0(cogRecordDisplayin0);
     updateDisplaySource1(cogRecordDisplayin1);
     updateDisplaySource2(cogRecordDisplayin2);
     if (null == vpppath0)
     {
         return false;
     }
     try
     {
         myJobManager0 = (CogJobManager)CogSerializer.LoadObjectFromFile(vpppath0);
         myJob0 = myJobManager0.Job(0);
         myJobIndependent0 = myJob0.OwnedIndependent;
         myJobManager0.UserQueueFlush();
         myJobManager0.FailureQueueFlush();
         myJob0.ImageQueueFlush();
         myJobIndependent0.RealTimeQueueFlush();
         // updateDisplaySource0(cogRecordDisplayin0);
         initS1 = true;
     }
     catch 
     { 
         initS1 = false;
     }
     if (null == vpppath1)
     {
         return false;
     }
     try
     {
         myJobManager1 = (CogJobManager)CogSerializer.LoadObjectFromFile(vpppath1);
         myJob1 = myJobManager1.Job(0);
         myJobIndependent1 = myJob1.OwnedIndependent;
         myJobManager1.UserQueueFlush();
         myJobManager1.FailureQueueFlush();
         myJob1.ImageQueueFlush();
         myJobIndependent1.RealTimeQueueFlush();
         // updateDisplaySource1(cogRecordDisplayin1);
         initS2 = true;
     }
     catch 
     {
         initS2 = false;
     }
     if (null == vpppath2)
     {
         return false;
     }
     try
     {
         myJobManager2 = (CogJobManager)CogSerializer.LoadObjectFromFile(vpppath2);
         myJob2 = myJobManager2.Job(0);
         myJobIndependent2 = myJob2.OwnedIndependent;
         myJobManager2.UserQueueFlush();
         myJobManager2.FailureQueueFlush();
         myJob2.ImageQueueFlush();
         myJobIndependent2.RealTimeQueueFlush();
         // updateDisplaySource2(cogRecordDisplayin2);
         initS3 = true;
     }
     catch 
     {
         inits3 = false;
     }
     if(inits1 == true && inits2 == true && initS3 == true)
     {
         return true;
     }
     return false;
 }
Example #9
0
 public bool Close()
 {
     if (null != myJobManager)
     {
         myJob.Reset();
         myJobManager.Stop();
         myJobManager.Shutdown();
         myJob = null;
         myJobManager = null;
         myJobIndependent = null;
         return true;
     }
     GC.Collect();
     return false;
 }
Example #10
0
        private void loadCognex()
        {
            try
            {
                myJobManager = (CogJobManager)CogSerializer.LoadObjectFromFile(visionProFilePath);
                myJob = myJobManager.Job(0);
                myIndependentJob = myJob.OwnedIndependent;

                //flush queues
                //myJobManager.UserQueueFlush();
                //myJobManager.FailureQueueFlush();
                //myJob.ImageQueueFlush();
                //myJob.ResetAllStatistics();
                //myIndependentJob.RealTimeQueueFlush();

                Trace.WriteLine("VisionProFile loaded.");
                Dispatcher.Invoke(new Action(() => { brd_Buttons.IsEnabled = true; brd_Loading.Visibility = Visibility.Collapsed; Panel.SetZIndex(brd_Loading, int.MinValue); }));
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Vision-Pro not ready! Exception:" + ex.Message);
            }
        }