示例#1
0
        private void RunProcess()
        {
            while (!_stopProcess)
            {
                if (this.Status == FactoryProcessStatus.Stopping)
                {
                    this._stopProcess = true;
                    this.Status       = FactoryProcessStatus.Stopped;
                }
                else if (this.Status == FactoryProcessStatus.Starting)
                {
                    this.Status       = FactoryProcessStatus.Running;
                    this._stopProcess = false;
                }
                else if (this.Status == FactoryProcessStatus.Pausing)
                {
                    this.Status       = FactoryProcessStatus.Paused;
                    this._stopProcess = false;
                    if (OnProcessPaused != null)
                    {
                        OnProcessPaused();
                    }
                }
                else if (this.Status == FactoryProcessStatus.Resuming)
                {
                    this.Status       = FactoryProcessStatus.Running;
                    this._stopProcess = false;
                }

                if (this.Status == FactoryProcessStatus.Running)
                {
                    if (this.OnTimeoutReached != null)
                    {
                        this.OnTimeoutReached();
                    }
                }

                if (this.Status == FactoryProcessStatus.Running || this.Status == FactoryProcessStatus.Paused)
                {
                    Thread.Sleep(this.Timeout);
                }
            }
        }
示例#2
0
 public void Stop()
 {
     this.Status = FactoryProcessStatus.Stopping;
 }
示例#3
0
 public void Start()
 {
     this.Status = FactoryProcessStatus.Starting;
     this.RunProcessAsync();
 }
示例#4
0
 public void Resume()
 {
     this.Status = FactoryProcessStatus.Resuming;
 }
示例#5
0
 public void Pause()
 {
     this.Status = FactoryProcessStatus.Pausing;
 }
示例#6
0
 void Factory_OnStatusChanged(FactoryProcessStatus status)
 {
     Console.WriteLine("Status changed to: {0}", status);
 }