Exemplo n.º 1
0
        private void InitRobot()
        {
            //init worker object
            FormRobotWorker = new RobotWorker();

            FormRobotWorker.StatusChanged += FormRobotWorker_StatusChanged;
            BindRobotJobsQueue();
        }
Exemplo n.º 2
0
 public RobotWorkerStatusChangeEventArgs(RobotWorker.RobotWorkerStatus RobotWorkerStatus,RobotJob CurrentJob,string Message)
 {
     _RobotWorkerStatus = RobotWorkerStatus;
     _CurrentJob=CurrentJob;
     _Message = Message;
 }
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);
            }
        }
Exemplo n.º 4
0
        private void InitRobot()
        {
            //init worker object
            FormRobotWorker = new RobotWorker();

            FormRobotWorker.StatusChanged += FormRobotWorker_StatusChanged;
            BindRobotJobsQueue();
        }