Ejemplo n.º 1
0
        public void Stop()
        {
            if (!engineInitialised) throw new Exception("You must initialise engine first");

            MessageEngineRunCommand stop = new MessageEngineRunCommand(EngineRunCommand.Stop);
            _actorTECoordinator.Tell(stop);
        }
 private void receiveEngineRunCommand(MessageEngineRunCommand msg)
 {
     MessageTick pulse = new MessageTick(0);
     if (msg.RunCommand == EngineRunCommand.RunMax && _runState != TickEngineRunState.RunningMax)
     {
         cancelPulse();
         _numberOfIncompleteSS = _subscribedActorSolarSystems.Count();
         _runState = TickEngineRunState.RunningMax;
         startTicksTimer();
         receiveTick(pulse);
     }
     else if (msg.RunCommand == EngineRunCommand.RunPulse && _runState != TickEngineRunState.Running)
     {
         _runState = TickEngineRunState.Running;
         _runCancel = Context.System.Scheduler.ScheduleTellRepeatedlyCancelable(0, 5, Self, pulse, ActorRefs.Nobody);
         startTicksTimer();
         receiveTick(pulse);
     }
     else if (msg.RunCommand == EngineRunCommand.Stop && _runState != TickEngineRunState.Stopped)
     {
         _runState = TickEngineRunState.Stopped;
         cancelPulse();
         _secondTimer.Stop();
     }
 }
Ejemplo n.º 3
0
        public void Run(bool maxRate)
        {
            if (!engineInitialised) throw new Exception("You must initialise engine first");

            MessageEngineRunCommand run;
            if (maxRate)
                run = new MessageEngineRunCommand(EngineRunCommand.RunMax);
            else
                run = new MessageEngineRunCommand(EngineRunCommand.RunPulse);

            _actorTECoordinator.Tell(run);
        }