GetTiming() public method

public GetTiming ( ) : ITiming
return ITiming
示例#1
0
        private void _Play(TimeSpan startTime, TimeSpan endTime)
        {
            if (IsRunning)
            {
                return;
            }
            if (Sequence == null)
            {
                return;
            }

            // Only hook the input stream during execution.
            // Hook before starting the behaviors.
            //_HookDataListener();

            // Bound the execution range.
            StartTime        = _CoerceStartTime(startTime);
            EndTime          = _CoerceEndTime(endTime);
            _IsTimedSequence = EndTime >= StartTime;

            if (StartTime == EndTime)
            {
                //We are done before we get started
                _syncContext.Post(x => _Stop(), null);
            }

            TimingSource = Sequence.GetTiming() ?? _GetDefaultTimingSource();

            _LoadMedia();

            _StartMedia();

            TimingSource.Position = StartTime;
            TimingSource.Start();

            // Start the crazy train.
            IsRunning = true;

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

            _endCheckTimer.Start();
        }
示例#2
0
        private void _Play(TimeSpan startTime, TimeSpan endTime)
        {
            if (IsRunning)
            {
                return;
            }
            if (Sequence == null)
            {
                return;
            }

            // Only hook the input stream during execution.
            // Hook before starting the behaviors.
            _HookDataListener();

            // Bound the execution range.
            StartTime = _CoerceStartTime(startTime);
            EndTime   = _CoerceEndTime(endTime);

            TimingSource = Sequence.GetTiming() ?? _GetDefaultTimingSource();

            _LoadMedia();

            _StartMedia();

            TimingSource.Position = StartTime;
            TimingSource.Start();

            // Start the crazy train.
            IsRunning = true;

            // Fire the first event manually because it takes a while for the timer
            // to elapse the first time.
            _CheckForNaturalEnd();

            // If there is no length, we may have been stopped as a cascading result
            // of that update.
            if (IsRunning)
            {
                _endCheckTimer.Start();
            }
        }