Exemple #1
0
 /// <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.");
     }
 }
Exemple #2
0
 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;
 }
Exemple #3
0
 public int Run1(int time, string _pathin, ref Result1 result)
 {
     Stop1();
     if(GetImage1(_pathin))
     {
         try
         {
             myJobManager1.Run())}
             System.Threading.Thread.Sleep(time);
         }
Exemple #4
0
 private void RunOnceButton_Click(object sender, System.EventArgs e)
 {
     try
     {
         myJobManager.Run();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Exemple #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);
 }
Exemple #6
0
 public bool Run(int time, string _pathin)
 {
     GetImage(_pathin);
     try
     {
         myJobManager.Run();
         System.Threading.Thread.Sleep(time);
     }
     catch { }
     return(true);
 }
        /// <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);
            }
        }