Beispiel #1
0
        private UPnPError OnGetRecordingStatus(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context)
        {
            outParams = new List <object>();
            IProgramInfoAsync     programInfo     = ServiceRegistration.Get <ITvProvider>() as IProgramInfoAsync;
            IScheduleControlAsync scheduleControl = ServiceRegistration.Get <ITvProvider>() as IScheduleControlAsync;

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

            int programId = (int)inParams[0];

            bool            result = false;
            IProgram        program;
            RecordingStatus recordingStatus = RecordingStatus.None;

            if (programInfo.GetProgram(programId, out program))
            {
                var scheduleResult = scheduleControl.GetRecordingStatusAsync(program).Result;
                if (scheduleResult.Success)
                {
                    result          = true;
                    recordingStatus = scheduleResult.Result;
                }
            }

            outParams = new List <object> {
                result, recordingStatus.ToString()
            };
            return(null);
        }
        public string GetStatusName(RecordingStatus status)
        {
            if (status == RecordingStatus.InProgress)
            {
                return("In Progress");
            }

            if (status == RecordingStatus.ConflictedNotOk)
            {
                return("Conflicted");
            }

            if (status == RecordingStatus.ConflictedOk)
            {
                return("Scheduled");
            }

            return(status.ToString());
        }
Beispiel #3
0
        private UPnPError OnGetRecordingStatus(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context)
        {
            outParams = new List <object>();
            IProgramInfo     programInfo     = ServiceRegistration.Get <ITvProvider>() as IProgramInfo;
            IScheduleControl scheduleControl = ServiceRegistration.Get <ITvProvider>() as IScheduleControl;

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

            int             programId = (int)inParams[0];
            IProgram        program;
            RecordingStatus recordingStatus = RecordingStatus.None;
            bool            result          = programInfo.GetProgram(programId, out program) && scheduleControl.GetRecordingStatus(program, out recordingStatus);

            outParams = new List <object> {
                result, recordingStatus.ToString()
            };
            return(null);
        }
        public string GetStatusName(RecordingStatus status)
        {
            if (status == RecordingStatus.InProgress)
            {
                return "In Progress";
            }

            if (status == RecordingStatus.ConflictedNotOk)
            {
                return "Conflicted";
            }

            if (status == RecordingStatus.ConflictedOk)
            {
                return "Scheduled";
            }

            return status.ToString();
        }