Ejemplo n.º 1
0
        private UPnPError OnGetNowNextProgramForGroup(DvAction action, IList <object> inParams, out IList <object> outParams, CallContext context)
        {
            outParams = new List <object>();
            IProgramInfo programInfo = ServiceRegistration.Get <ITvProvider>() as IProgramInfo;

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

            int channelGroupId        = (int)inParams[0];
            IList <IProgram> programs = new List <IProgram>();
            IDictionary <int, IProgram[]> nowNextPrograms;

            // Flatten to simple list for UPnP transfer
            if (programInfo.GetNowAndNextForChannelGroup(new ChannelGroup {
                ChannelGroupId = channelGroupId
            }, out nowNextPrograms))
            {
                foreach (KeyValuePair <int, IProgram[]> nowNextProgram in nowNextPrograms)
                {
                    foreach (var program in nowNextProgram.Value)
                    {
                        if (program != null)
                        {
                            programs.Add(program);
                        }
                    }
                }
            }
            outParams = new List <object> {
                true, programs
            };
            return(null);
        }