Exemple #1
0
        private void _loopPlay()
        {
            // Stop whatever is driving this crazy train.
            lock (_endCheckTimer)
            {
                _endCheckTimer.Enabled = false;
            }

            TimingSource.Stop();

            //Reset our position. No need to stop the media, we will just reset its position.
            TimingSource.Position = StartTime;

            OnSequenceReStarted(new SequenceStartedEventArgs(Sequence, TimingSource, StartTime, EndTime));

            //Fire it back up again.
            TimingSource.Start();

            while (TimingSource.Position == StartTime)
            {
                Thread.Sleep(1);                 //Give the train a chance to get out of the station.
            }

            _endCheckTimer.Enabled = true;
        }
 /// <summary>
 /// Completes the generation process and restarts all the contexts that were running when the BeginGeneration method was called.
 /// </summary>
 public void EndGeneration()
 {
     TimingSource.Stop();
     VixenSystem.Elements.ClearStates();
     if (_context != null)
     {
         VixenSystem.Contexts.ReleaseContext(_context);
     }
     foreach (var runningContext in _runningContexts)
     {
         runningContext.Resume();
     }
     //restart the devices
     VixenSystem.OutputDeviceManagement.ResumeAll();
 }
        /// <summary>
        /// Create a cache of the entire sequence command outputs
        /// </summary>
        private void _BuildSequenceCache()
        {
            //Need some hooks in here for progess....... Need to think about that.
            //Stop the output devices from driving the execution engine.
            VixenSystem.OutputDeviceManagement.PauseAll();
            IEnumerable <IContext> runningContexts = VixenSystem.Contexts.Where(x => x.IsRunning);

            foreach (var runningContext in runningContexts)
            {
                runningContext.Pause();
            }
            _outputCount = VixenSystem.OutputControllers.GetAll().Sum(x => x.OutputCount);
            VixenSystem.Elements.ClearStates();
            //Special context to pre cache commands. We don't need all the other fancy executor or timing as we will advance it ourselves
            PreCachingSequenceContext context = VixenSystem.Contexts.GetCacheCompileContext();

            context.Sequence = Sequence;
            TimingSource.Start();
            context.Start();

            while (TimingSource.Position <= Sequence.Length && IsRunning)
            {
                List <CommandOutput> commands = _UpdateState(TimingSource.Position);
                Cache.OutputStateListAggregator.AddCommands(commands);
                //Advance the timing
                TimingSource.Increment();
            }

            TimingSource.Stop();
            context.Stop();
            foreach (var runningContext in runningContexts)
            {
                runningContext.Resume();
            }

            VixenSystem.Contexts.ReleaseContext(_context);
            //restart the devices
            VixenSystem.OutputDeviceManagement.ResumeAll();
            IsRunning = false;
            //Cache is now ready to use or save.
            //cache.Save();
            // To load the cache use the following
            //ISequenceCache cache2 = SequenceService.Instance.LoadCache(cache.SequenceFilePath);
        }
Exemple #4
0
        private void _Stop()
        {
            if (!IsRunning)
            {
                return;
            }

            // Stop whatever is driving this crazy train.
            lock (_endCheckTimer) {
                _endCheckTimer.Stop(false);
            }

            // Release the hook before the behaviors are shut down so that
            // they can affect the sequence.
            //_UnhookDataListener();

            TimingSource.Stop();
            _StopMedia();

            IsRunning = false;
            IsPaused  = false;
        }
Exemple #5
0
        private void _loopPlay()
        {
            TimingSource.Stop();
            // Stop whatever is driving this crazy train.
            lock (_endCheckTimer)
            {
                _endCheckTimer.Stop();
            }
            //Stop running to trigger events to reset the sequence
            IsRunning = false;
            //Reset our position. No need to stop the media, we will just reset its position.
            TimingSource.Position = StartTime;
            Thread.Sleep(50);             //Give everything a chance to stop before we fire it all back up again.
            //Fire it back up again.
            IsRunning = true;
            TimingSource.Start();

            while (TimingSource.Position == StartTime)
            {
                Thread.Sleep(1);                 //Give the train a chance to get out of the station.
            }

            _endCheckTimer.Start();
        }