protected void populateChannelGroups() { ServiceInterface server = new ServiceInterface(); cbGroup.Items.Clear(); List<WebChannelGroup> groups=null; if (cbChannelType.SelectedIndex == 1) groups = server.GetTvChannelGroups(); else if (cbChannelType.SelectedIndex == 2) groups = server.GetRadioChannelGroups(); else { cbGroup.Items.Clear(); cbChannel.Items.Clear(); return; } int idx = 0; int allIndex = -1; foreach (WebChannelGroup g in groups) { if (g.name == "All Channels" && allIndex == -1) allIndex = idx; cbGroup.Items.Add(new ListItem(g.name, g.idGroup.ToString())); idx++; } cbGroup.SelectedIndex = allIndex; populateChannels(); }
protected void RefreshRadio() { ServiceInterface server = new ServiceInterface(); if (cbRadioGroups.Items.Count == 0) { List<WebChannelGroup> radiogroups = server.GetRadioChannelGroups(); int i = 0; int index = -1; int allIndex = -1; foreach (WebChannelGroup g in radiogroups) { if (g.name == "All Channels" && allIndex != -1) allIndex = i; if (g.name != "All Channels" && index != -1) index = i; cbRadioGroups.Items.Add(new ListItem(g.name, g.idGroup.ToString())); i++; } if (index != -1) cbRadioGroups.SelectedIndex = index; else cbRadioGroups.SelectedIndex = allIndex; } List<WebMiniEPG> epgs = server.GetRadioMiniEPGForGroup(Int32.Parse(cbRadioGroups.SelectedValue)); DataTable dt = new DataTable(); dt.Columns.Add("channel", typeof(string)); dt.Columns.Add("now_next", typeof(string)); dt.Columns.Add("idChannel", typeof(int)); dt.Columns.Add("logo", typeof(string)); foreach (WebMiniEPG epg in epgs) { if (epg.idChannel == 0) continue; DataRow row = dt.NewRow(); row["channel"] = epg.name; row["now_next"] = epg.epgNow.startTime.ToShortTimeString() + " - " + epg.epgNow.endTime.ToShortTimeString() + ": " + epg.epgNow.title + "<br/>" + epg.epgNext.startTime.ToShortTimeString() + " - " + epg.epgNext.endTime.ToShortTimeString() + ": " + epg.epgNext.title; row["idChannel"] = epg.idChannel; row["logo"] = Utils.GetLogoURL(epg.name,false); dt.Rows.Add(row); } gridRadio.DataSource = dt; gridRadio.DataBind(); int width; int height; Utils.GetThumbDimensions(out width, out height); gridRadio.Columns[0].ControlStyle.Width = width; gridRadio.Columns[0].ControlStyle.Height = height; LoadStreamingProfiles(cbRadioProfiles); }