Example #1
0
        public override IPlaybillItem Clone(PlayRange newRange)
        {
            var result = new AutoPlaybillItem(this.PlaySource.Clone(newRange));

            result.IsAutoPadding = this.IsAutoPadding; // ?
            result.Id            = Guid.NewGuid();
            return(result);
        }
Example #2
0
        internal static AutoPlayItem CreateAutoPadding(DateTime startTime, TimeSpan duration)
        {
            AutoPlaybillItem billItem = AutoPlaybillItem.CreateAutoPadding(duration);
            AutoPlayItem     playItem = new AutoPlayItem(billItem);

            playItem.StartTime = startTime;
            return(playItem);
        }
Example #3
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;
        }
Example #4
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;
        }