private void Grouped() { _groups = new ObservableCollection<GroupChannel>(); foreach (ChannelGroup item in App.ViewModel.UserAccount.channel_group) { ComboBoxItem cbi = new ComboBoxItem(); cbi.Name = item.name; cbi.Content = item.name; ChCategory.Items.Add(cbi); ind++; var g = new GroupChannel{ GroupName = item.name}; foreach (Channel it in item.Channels) { Channel c = new Channel(); c = it; //c.icon = "http://sovok.tv" + c.icon; g.Channels.Add(c); } _groups.Add(g); } ComboBoxItem fcbi = new ComboBoxItem(); fcbi.Content = fcbi.Name = "Favorite"; ChCategory.Items.Add(fcbi); ind++; CList.Source = _groups; }
private void ShowCategory(int index) { _groups.Clear(); if (index == ind) { var fg = new GroupChannel { GroupName = "Favorite" }; foreach (FavoriteChannel item in App.ViewModel.UserAccount.favorite_channel) { Channel fc = new Channel(); foreach (СhannelItem it in App.ViewModel.ChannelList) { if (item.id_channel == it.ChannelId) { fc.epg_end = it.epg_end; fc.epg_progname = it.Epg; fc.epg_start = it.epg_start; fc.icon = it.Image_Source.ToString(); fc.name = it.ChannelName; break; } } fg.Channels.Add(fc); } _groups.Add(fg); } else { if (index<=0 || index>=App.ViewModel.UserAccount.channel_group.Count) { index = 0; } try { ChannelGroup item = App.ViewModel.UserAccount.channel_group[index]; var g = new GroupChannel { GroupName = item.name }; foreach (Channel it in item.Channels) { Channel c = new Channel(); c = it; g.Channels.Add(c); } _groups.Add(g); }catch(Exception ex) { var mes = new MessageDialog(index+"\n"+App.ViewModel.UserAccount.channel_group.Count); mes.ShowAsync(); } } CList.Source = _groups; }
private void Grouped() { _groups = new ObservableCollection<GroupChannel>(); foreach (ChannelGroup item in App.ViewModel.UserAccount.channel_group) { ComboBoxItem cbi = new ComboBoxItem(); cbi.Name = item.name; cbi.Content = item.name; ChCategory.Items.Add(cbi); var g = new GroupChannel{ GroupName = item.name}; foreach (Channel it in item.Channels) { Channel c = new Channel(); c = it; //c.icon = "http://sovok.tv" + c.icon; g.Channels.Add(c); } _groups.Add(g); } //var fg = new GroupChannel { GroupName = "Favorite" }; ComboBoxItem fcbi = new ComboBoxItem(); fcbi.Content = fcbi.Name = "Favorite"; ChCategory.Items.Add(fcbi); /*foreach (FavoriteChannel item in App.ViewModel.UserAccount.favorite_channel) { Channel fc = new Channel(); foreach (СhannelItem it in App.ViewModel.ChannelList) { if (item.id_channel==it.ChannelId) { fc.epg_end = it.epg_end; fc.epg_progname = it.Epg; fc.epg_start = it.epg_start; fc.icon = it.Image_Source.ToString(); fc.name = it.ChannelName; break; } } fg.Channels.Add(fc); } _groups.Add(fg);*/ CList.Source = _groups; }