コード例 #1
0
        protected virtual RecordingStatus?CreateOrDeleteScheduleByTime(IChannel program, DateTime start, DateTime end)
        {
            IScheduleControl scheduleControl = _tvHandler.ScheduleControl;
            RecordingStatus? newStatus       = null;

            if (scheduleControl != null)
            {
                ISchedule schedule;
                if (scheduleControl.CreateScheduleByTime(program, start, end, ScheduleRecordingType.Once, out schedule))
                {
                    newStatus = RecordingStatus.Scheduled;
                }
            }
            return(newStatus);
        }
コード例 #2
0
        private UPnPError OnCreateScheduleByTime(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context)
        {
            outParams = new List <object>();
            IScheduleControl     scheduleControl     = ServiceRegistration.Get <ITvProvider>() as IScheduleControl;
            IChannelAndGroupInfo channelAndGroupInfo = ServiceRegistration.Get <ITvProvider>() as IChannelAndGroupInfo;

            if (scheduleControl == null || channelAndGroupInfo == null)
            {
                return(new UPnPError(500, "IChannelAndGroupInfo or IScheduleControl service not available"));
            }

            int      channelId = (int)inParams[0];
            DateTime startTime = (DateTime)inParams[1];
            DateTime endTime   = (DateTime)inParams[2];
            ScheduleRecordingType recordingType = (ScheduleRecordingType)inParams[3];
            ISchedule             schedule      = null;

            IChannel channel;
            bool     result = channelAndGroupInfo.GetChannel(channelId, out channel) && scheduleControl.CreateScheduleByTime(channel, startTime, endTime, recordingType, out schedule);

            outParams = new List <object> {
                result, schedule
            };
            return(null);
        }