Beispiel #1
0
 private void BeginChangeText(XTaskState sts)
 {
     try
     {
         if (this.IsHandleCreated && (!this.IsDisposed))
         {
             this.BeginInvoke(new Action <XTaskState>(ChangeText), new object[] { sts });
         }
     }
     catch
     {
     }
 }
Beispiel #2
0
        private void StartProcess()
        {
            Process.Start();

            // Initialize the process' xml state and collect the info to be serialized
            XProcessState = new XElement(XSessionNames.ProcessState
                                         , new XAttribute(XSessionNames.AProcessID, Process.Id)
                                         , new XAttribute(XSessionNames.AStartTime, Process.StartTime)
                                         );
            XTaskState.Add(XProcessState);

            OnProcessStarted();
        }
Beispiel #3
0
        private void CompleteWithError(Exception ex)
        {
            Debug.Assert(ex != null);
            ErrorEx = ex;

            // Create the node and add it to our state xml
            var xerror = XNames.CreateXError(ex);

            XTaskState.Add(xerror);

            IsComplete = true;
            Status     = AppTaskStatus.Error;

            OnCompletedWithError();
        }
Beispiel #4
0
        private void ChangeText(XTaskState sts)
        {
            switch (sts)
            {
            case XTaskState.ESTOP:
                button1.Text           = "急停按下>>>等待复位";
                this.button1.BackColor = Red;
                break;

            case XTaskState.ALARM:
                button1.Text           = "发现报警>>>等待复位";
                this.button1.BackColor = Red;
                break;

            case XTaskState.PAUSE:
                button1.Text           = "暂停中>>>等待运行";
                this.button1.BackColor = Green;
                break;

            case XTaskState.RESETING:
                button1.Text           = "复位中>>>";
                this.button1.BackColor = Color.Orange;
                break;

            case XTaskState.RUNNING:
                button1.Text           = "运行中>>>";
                this.button1.BackColor = Color.Orange;
                break;

            case XTaskState.STOP:
                button1.Text = XTaskManager.Instance.Tasks[taskId].HomeOK ? "正常停止>>>等待运行" : "异常停止>>>等待复位";
                //button1.Text = "停止>>>等待复位";//停止不一定需要复位
                this.button1.BackColor = XTaskManager.Instance.Tasks[taskId].HomeOK ?Green:Red;
                break;

            case XTaskState.WAITRESET:
                button1.Text           = ">>>等待复位";
                this.button1.BackColor = Red;
                break;

            case XTaskState.WAITRUN:
                button1.Text           = ">>>等待运行";
                this.button1.BackColor = Green;
                break;
            }
        }
Beispiel #5
0
        public void SetState(XTaskState sts)
        {
            lock (this)
            {
                m_State = sts;
            }
            if (OnStationStateChanged != null)
            {
                OnStationStateChanged(m_State);
            }
            switch (sts)
            {
            case XTaskState.ESTOP:
                StopWatch_Stop();
                break;

            case XTaskState.ALARM:
                StopWatch_Stop();
                break;

            case XTaskState.RESETING:
                StopWatch_Reset();
                break;

            case XTaskState.RUNNING:
                break;

            case XTaskState.PAUSE:
                StopWatch_Stop();
                break;

            case XTaskState.STOP:
                break;

            case XTaskState.WAITRESET:
                StopWatch_Stop();
                break;

            case XTaskState.WAITRUN:
                StopWatch_Stop();
                break;
            }
        }