Example #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);
                }
            }
        }
Example #2
0
 public void Stop()
 {
     this.Status = FactoryProcessStatus.Stopping;
 }
Example #3
0
 public void Start()
 {
     this.Status = FactoryProcessStatus.Starting;
     this.RunProcessAsync();
 }
Example #4
0
 public void Resume()
 {
     this.Status = FactoryProcessStatus.Resuming;
 }
Example #5
0
 public void Pause()
 {
     this.Status = FactoryProcessStatus.Pausing;
 }
Example #6
0
 void Factory_OnStatusChanged(FactoryProcessStatus status)
 {
     Console.WriteLine("Status changed to: {0}", status);
 }