public void Run()
        {
            this.State = XerisState.Starting;

            while (this.State != XerisState.Stopped)
            {
                switch (this.State)
                {
                    case XerisState.Running:
                        if (this.OnRunning != null)
                            this.OnRunning.Invoke(null, new EventArgs());
                        break;
                    case XerisState.Paused:
                        if (this.OnPaused != null)
                            this.OnPaused.Invoke(null, new EventArgs());
                        break;
                    case XerisState.Starting:
                        if (this.OnStarting != null)
                            this.OnStarting.Invoke(null, new EventArgs());

                        this.State = XerisState.Running;
                        break;
                    case XerisState.Stopping:
                        if (this.OnStopping != null)
                            this.OnStopping.Invoke(null, new EventArgs());

                        this.State = XerisState.Stopped;
                        break;
                    case XerisState.Pausing:
                        if (this.OnPause != null)
                            this.OnPause.Invoke(null, new EventArgs());

                        this.State = XerisState.Paused;
                        break;
                    case XerisState.Resuming:
                        if (this.OnResume != null)
                            this.OnResume.Invoke(null, new EventArgs());

                        this.State = XerisState.Running;
                        break;
                    default:
                        Logger.Error("The engine entered an unknown state, aborting...");
                        this.State = XerisState.Stopped;
                        break;
                }
            }
        }
 public void Stop()
 {
     if (this.State == XerisState.Running)
         this.State = XerisState.Stopping;
 }
 public void Pause()
 {
     if (this.State == XerisState.Running)
         this.State = XerisState.Pausing;
 }
 public void Resume()
 {
     if (this.State == XerisState.Paused)
         this.State = XerisState.Running;
 }
Esempio n. 5
0
 public static void SetState(XerisState value)
 {
     state = (ulong)value;
 }