Exemplo n.º 1
0
        private void AddPlayItem(MediaItem mediaItem, PlayScheduleMode scheduleMode, DateTime?startTime)
        {
            PlaylistBuilder builder  = CreateBuilder();
            PlaybillItem    billItem = null;


            try
            {
                switch (scheduleMode)
                {
                case PlayScheduleMode.Timing:
                    billItem = PlaybillItem.Timing(mediaItem, startTime.Value);
                    builder.AddTimingItem((TimingPlaybillItem)billItem);
                    break;

                case PlayScheduleMode.Auto:
                    billItem = PlaybillItem.Auto(mediaItem);
                    builder.AddAutoItem(new AutoPlayItem(billItem),
                                        this.SelectedPlayItem != null ? this.SelectedPlayItem.PlayItem : null);
                    break;

                case PlayScheduleMode.TimingBreak:
                    billItem = PlaybillItem.TimingBreak(mediaItem, startTime.Value);
                    builder.AddTimingBreakItem((TimingPlaybillItem)billItem);
                    break;
                }

                Rebuild(builder);
            }
            catch (Exception ex)
            {
                //editor.Rollback();
                OnError(ex);
            }
        }
Exemplo n.º 2
0
        public bool CanEdit(IPlayItem playItem, EditOption option, object context = null)
        {
            switch (option)
            {
            case EditOption.Duration:
                return(!playItem.IsAutoPadding() && (playItem.MediaSource is IChannelMediaSource));

            case EditOption.StartTime:
                return(playItem.ScheduleMode == PlayScheduleMode.Timing || playItem.ScheduleMode == PlayScheduleMode.TimingBreak);

            case EditOption.SourceAndPlayRange:
                return(true);

            case EditOption.SourceOnly:
                PlayRange newRange = (PlayRange)context;
                return(newRange.Duration >= playItem.CalculatedPlayDuration);

            case EditOption.ScheduleMode:
                PlayScheduleMode newMode = (PlayScheduleMode)context;
                return((newMode != playItem.ScheduleMode) && (newMode == PlayScheduleMode.Auto || !playItem.IsAutoPadding()));

            case EditOption.Move:
                return(!playItem.IsAutoPadding() && playItem.ScheduleMode == PlayScheduleMode.Auto);
            }

            return(false);
        }
Exemplo n.º 3
0
 private static PlayItemAddContext CreateContext(IPlayItem playItem, PlayScheduleMode scheduleMode)
 {
     return(new PlayItemAddContext
     {
         PlayItem = playItem,
         ScheduleMode = scheduleMode
     });
 }
Exemplo n.º 4
0
        // 顺播改为定时播或定时插播。
        // 定时播或定时插播改为顺播。
        // 定时播改为定时插播。
        // 定时插播改为定时播。
        public void ChangeSchedule(IPlayItem playItem, PlayScheduleMode scheduleMode, DateTime?startTime)
        {
            Debug.Assert(scheduleMode != playItem.ScheduleMode);

            if (scheduleMode == PlayScheduleMode.Auto)
            {
                ChangeToAutoScheduleInternal(playItem);
            }
            else
            {
                ChangeToTimingScheduleInternal(playItem, scheduleMode, startTime);
            }
        }
Exemplo n.º 5
0
        private void AddPlayItem(MediaItem mediaItem, PlayScheduleMode scheduleMode, DateTime?startTime)
        {
            using (var editor = this.Edit())
            {
                try
                {
                    PlaybillItem billItem = null;
                    switch (scheduleMode)
                    {
                    case PlayScheduleMode.Timing:
                        billItem = PlaybillItem.Timing(mediaItem, startTime.Value);
                        editor.AddTiming((TimingPlaybillItem)billItem);
                        break;

                    case PlayScheduleMode.Auto:
                        billItem = PlaybillItem.Auto(mediaItem);
                        if (this.SelectedPlayItem != null)
                        {
                            editor.AddAuto(this.SelectedPlayItem.PlayItem, new AutoPlayItem(billItem));
                        }
                        else
                        {
                            editor.AddAuto(new AutoPlayItem(billItem));
                        }
                        break;

                    case PlayScheduleMode.TimingBreak:
                        billItem = PlaybillItem.TimingBreak(mediaItem, startTime.Value);
                        editor.AddTiming((TimingPlaybillItem)billItem);
                        break;
                    }
                }
                catch (Exception ex)
                {
                    editor.Rollback();
                    RaiseDisplayMessageInteractionRequest("错误", ex.Message);
                }
            }
        }
Exemplo n.º 6
0
 protected PlaybillItem(IPlaySource playSource, PlayScheduleMode scheduleMode)
 {
     this.Id           = Guid.NewGuid();
     this.PlaySource   = playSource;
     this.ScheduleMode = scheduleMode;
 }
Exemplo n.º 7
0
 public IPlayItem ChangeScheduleMode(PlayScheduleMode newScheduleMode, DateTime startTime)
 {
     throw new NotImplementedException();
 }