public CueList(int? iterations = null, bool bounce = false, [System.Runtime.CompilerServices.CallerMemberName] string name = "")
{
this.iterations = iterations;
this.iterationsLeft = iterations;
this.bounce = bounce;
this.name = name;
this.cues = new List<Cue>();
this.deviceObserversBrightness = new Dictionary<IReceivesBrightness, ControlledObserver<double>>();
this.deviceObserversColor = new Dictionary<IReceivesColor, ControlledObserver<Color>>();
this.deviceObserversPan = new Dictionary<IReceivesPanTilt, ControlledObserver<double>>();
this.deviceObserversTilt = new Dictionary<IReceivesPanTilt, ControlledObserver<double>>();
this.direction = 1;
this.currentCuePos = -1;
this.heldLocks = new Dictionary<IOwnedDevice, IControlToken>();
this.triggerNext = new ManualResetEvent(false);
this.triggerCancelSources = new Dictionary<Cue, CancellationTokenSource>();
this.cueListTime = new Stopwatch();
this.currentCueId = new ReplaySubject<int?>(1);
this.currentCueId.OnNext(null);
this.cueCompleted = new Subject<Tuple<int, long>>();
this.LockPriority = 1;
this.cancelSource = new CancellationTokenSource();
this.cueListExecutor = new Task(() =>
{
while (!this.cancelSource.IsCancellationRequested)
{
WaitHandle.WaitAny(new WaitHandle[] {
this.cancelSource.Token.WaitHandle,
this.triggerNext
});
if (this.cancelSource.IsCancellationRequested)
break;
this.triggerNext.Reset();
NextCue();
}
},
cancelSource.Token,
TaskCreationOptions.LongRunning);
Executor.Current.Register(this);
}