Ejemplo n.º 1
0
        internal void ChangeTimingToAuto(IPlayItem playItem)
        {
            var index = _playItems.IndexOf(playItem);

            if (index < 0)
            {
                throw new InvalidOperationException();
            }
            //Debug.Assert();
            var newPlayItem = new AutoPlayItem(AutoPlaybillItem.Auto(playItem.PlaybillItem.PlaySource));

            _playItems[index] = newPlayItem;
            this.IsDirty      = true;
        }
Ejemplo n.º 2
0
        internal void ChangeSource(IPlayItem playItem, IMediaSource newSource, PlayRange?newRange)
        {
            int index = _playItems.IndexOf(playItem);

            if (index < 0)
            {
                throw new ArgumentException();
            }

            IPlayItem newPlayItem = null;

            if (newRange != null && playItem.ScheduleMode != PlayScheduleMode.Auto)
            {
                if (newRange.Value.Duration > playItem.PlayRange.Duration)
                {
                    var newStopTime = playItem.StartTime.Add(newRange.Value.Duration);
                    if (this.HasTimingConflict(playItem.StartTime, newStopTime, playItem))
                    {
                        throw new InvalidOperationException();
                    }
                }
            }
            else
            {
            }

            newRange = newRange == null ? new PlayRange(TimeSpan.Zero, playItem.CalculatedPlayDuration) : newRange.Value;
            var newPlaySource = new PlaySource(newSource, newRange.Value, playItem.PlaybillItem.PlaySource.CGItems);

            switch (playItem.ScheduleMode)
            {
            case PlayScheduleMode.Auto:
                newPlayItem = new AutoPlayItem(AutoPlaybillItem.Auto(newPlaySource));
                break;

            case PlayScheduleMode.Timing:
                newPlayItem = (IPlayItem)TimingPlaybillItem.Timing(newPlaySource, playItem.StartTime);
                break;

            case PlayScheduleMode.TimingBreak:
                newPlayItem = (IPlayItem)TimingPlaybillItem.TimingBreak(newPlaySource, playItem.StartTime);
                break;
            }

            _playItems[index] = newPlayItem;
            this.IsDirty      = true;
        }