Exemplo n.º 1
0
        private void UpdateRunningJob()
        {
            string RunningJobNameText;
            string RunningJobStatusText;

            if (RuningJob != null)
            {
                RunningJobNameText   = RuningJob.ScriptName;
                RunningJobStatusText = RuningJob.JobStatus.ToString();
            }
            else
            {
                RunningJobNameText   = string.Empty;
                RunningJobStatusText = string.Empty;
            }

            if (!this.IsDisposed)
            {
                MethodInvoker UpdateRunningJobName = delegate
                {
                    RunningJobName.Text = RunningJobNameText;
                };
                RunningJobName.BeginInvoke(UpdateRunningJobName);

                MethodInvoker UpdateRunningJobStatus = delegate
                {
                    RunningJobStatus.Text = RunningJobStatusText;
                };
                RunningJobStatus.BeginInvoke(UpdateRunningJobStatus);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 設定 Job State.
        /// </summary>
        /// <param name="jobId"></param>
        /// <param name="status"></param>
        public static void SetJobStatus(string jobId, JobStatus status)
        {
            RunningJobStatus rs = RunningJobStatuss.Where(c => c.JobId == jobId).FirstOrDefault();

            if (rs != null)
            {
                rs.Status = status;
            }
        }
Exemplo n.º 3
0
        void FormRobotWorker_StatusChanged(object sender, RobotWorkerStatusChangeEventArgs e)
        {
            string Message;

            if (e.RobotWorkerStatus == RobotWorker.RobotWorkerStatus.RunningJob && e.CurrentJob != null)
            {
                Message = string.Format("{0}-{1}({2}), parameters:{3}) ,{4}", e.RobotWorkerStatus, e.CurrentJob.ScriptName, e.CurrentJob.UniqueID, e.CurrentJob.RobotJobDisplayParameters, e.Message);
            }
            else
            {
                Message = string.Format("{0} - {1}", e.RobotWorkerStatus, e.Message);
            }
            Notify(new LoggingEntery("OctoTipPlus Appilcation", "RobotWorker", "RunningJob", Message, LoggingEntery.EnteryTypes.Debug));


            if (e.CurrentJob == null)
            {
                RuningJob = null;
                UpdateRunningJob();
            }
            else
            {
                RuningJob = e.CurrentJob;
                UpdateRunningJob();
            }

            bool buttonPauseEnabled;
            bool buttonStartEnabled;
            bool buttonStopEnabled;

            string textBoxRuningJobStatusText = string.Empty;
            string textRobotWorkerStatusText  = string.Empty;

            textRobotWorkerStatusText = RobotWorker.GetRobotWorkerStatusText(e.RobotWorkerStatus);

            switch (e.RobotWorkerStatus)
            {
            case (RobotWorker.RobotWorkerStatus.Stopped):
                buttonPauseEnabled = false;
                buttonStartEnabled = true;
                buttonStopEnabled  = false;
                break;

            case (RobotWorker.RobotWorkerStatus.Paused):
                buttonPauseEnabled = false;
                buttonStartEnabled = true;
                buttonStopEnabled  = true;
                break;

            case (RobotWorker.RobotWorkerStatus.Stopping):
                buttonPauseEnabled = false;
                buttonStartEnabled = false;
                buttonStopEnabled  = false;
                break;

            case (RobotWorker.RobotWorkerStatus.Pausing):
                buttonPauseEnabled = false;
                buttonStartEnabled = false;
                buttonStopEnabled  = false;
                break;

            default:
                buttonPauseEnabled = true;
                buttonStartEnabled = false;
                buttonStopEnabled  = true;
                break;
            }

            if (!this.IsDisposed)
            {
                MethodInvoker buttonPauseInvoker = delegate
                {
                    buttonRobotPause.Enabled = buttonPauseEnabled;
                };
                buttonRobotPause.BeginInvoke(buttonPauseInvoker);

                MethodInvoker buttonStartInvoker = delegate
                {
                    buttonRobotStart.Enabled = buttonStartEnabled;
                };
                buttonRobotStart.BeginInvoke(buttonStartInvoker);

                MethodInvoker buttonStopInvoker = delegate
                {
                    buttonRobotStop.Enabled = buttonStopEnabled;
                };
                buttonRobotStop.BeginInvoke(buttonStopInvoker);

                MethodInvoker textBoxRuningJobStatusInvoker = delegate
                {
                    RunningJobStatus.Text = textBoxRuningJobStatusText;
                };
                RunningJobStatus.BeginInvoke(textBoxRuningJobStatusInvoker);

                MethodInvoker textRobotWorkerStatusInvoker = delegate
                {
                    RobotStatuslabel.Text = textRobotWorkerStatusText;
                };
                RunningJobStatus.BeginInvoke(textRobotWorkerStatusInvoker);
            }
        }