コード例 #1
0
ファイル: Vision.cs プロジェクト: wangaili/VisionProAPI
 /// <summary>
 /// 运行Job
 /// </summary>
 ///
 /// <param name="time">< 运行等待时间 ></param>
 /// <param name="_pathin">< 图片路径 ></param>
 /// <param name="result">< 结果结构体 ></param>
 ///
 /// <returns>< 字符串显示错误信息 ></returns>
 public string Run(string _pathin, ref Result result, int time = 500)
 {
     Stop();
     if (GetImage(_pathin))
     {
         try
         {
             myJobManager.Run();
             System.Threading.Thread.Sleep(time);
         }
         catch
         {
             return("Error: JobManager run fail.");
         }
         if (GetResult(ref result))
         {
             Stop();
             return("Success!");
         }
         else
         {
             return("Get result fail");
         }
     }
     else
     {
         return("Error: Get image fail.");
     }
 }
コード例 #2
0
ファイル: Vision1.cs プロジェクト: wangaili/VisionProAPI
 public int Run3(int time, string _pathin, ref Result2 result)
 {
     Stop3();
     if(GetImage3(_pathin))
     {
         try
         {
             myJobManager3.Run())
             System.Threading.Thread.Sleep(time);
         }
         catch
         {
             return 2;
         }
         if(GetResult3(ref result))
         {
             Stop3();
             return 0;
         }
         else
         {
             return 3;
         }
     }
     else
     {
         return 1;
     }
     return 4;
 }
コード例 #3
0
ファイル: Vision2.cs プロジェクト: wangaili/VisionProAPI
 public int Run1(int time, string _pathin, ref Result1 result)
 {
     Stop1();
     if(GetImage1(_pathin))
     {
         try
         {
             myJobManager1.Run())}
             System.Threading.Thread.Sleep(time);
         }
コード例 #4
0
 private void RunOnceButton_Click(object sender, System.EventArgs e)
 {
     try
     {
         myJobManager.Run();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #5
0
 public bool Run(int time, int numOfJobs, List <string> _pathin)
 {
     GetImage(numOfJobs, _pathin);
     try
     {
         myJobManager.Run();
         System.Threading.Thread.Sleep(time);
     }
     catch { }
     return(true);
 }
コード例 #6
0
 public bool Run(int time, string _pathin)
 {
     GetImage(_pathin);
     try
     {
         myJobManager.Run();
         System.Threading.Thread.Sleep(time);
     }
     catch { }
     return(true);
 }
コード例 #7
0
        /// <summary>
        /// This function handles the click event for the RunOnce button
        /// notice that it disables some other functionality that prevents
        /// the user from trying to do other things while the job is
        /// allready running.  The functionality is re-enabled when the
        /// CogJobManager raises or fires its "stopped" event.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RunOnceButton_Click(object sender, EventArgs e)
        {
            try
            {
                RunOnceButton.Enabled     = false;
                RunContCheckBox.Enabled   = false; // Disable if running
                ShowTrainCheckBox.Enabled = false;

                myJobManager.Run();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }