private void lstLiveChannel_Follow_Category_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { LiveChannelClass liveChannelObj = (sender as ListBox).SelectedItem as LiveChannelClass; NavigationService.Navigate(new Uri("/Live_Channel_Player.xaml?live_channel_id=" + liveChannelObj.live_channel_id + "&live_channel_url=" + liveChannelObj.live_channel_url + "&live_channel_folder=" + liveChannelObj.live_channel_folder, UriKind.Relative)); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
void client_1_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { string data = e.Result; this.responseResult = data; //bool result = tvodUltility.writeDataToFile(this.responseResult, this.folder, this.childCategoryFile); parseJSONLiveChannelList(this.responseResult); ds = new ObservableCollection <LiveChannelClass>(); ds.Clear(); if (this.numberVideo > 0) { for (int i = 0; i < numberVideoPerPage; i++) { liveChannelObj = new LiveChannelClass(); liveChannelObj = listLiveChannel[i]; //string source_image = imgCache.getImage(parentCategoryObj.category_image); string source_image = ""; if (fixCacheImage == true) { source_image = imgCache.getImage_2(liveChannelObj.live_channel_id); } else //Day la hoan thien nhat tuy nhien can thoi gian de fix data ( cache Image) { source_image = imgCache.getImage(liveChannelObj.video_picture_path); } ds.Add(new LiveChannelClass() { video_picture_path = source_image, live_channel_title = liveChannelObj.live_channel_title, live_channel_id = liveChannelObj.live_channel_id, live_channel_folder = liveChannelObj.live_channel_folder, live_channel_url = liveChannelObj.live_channel_url }); } this.lstLiveChannel_Follow_Category.ItemsSource = ds; } else { ds.Add(new LiveChannelClass() { video_picture_path = "http", live_channel_title = "Không có dữ liệu", live_channel_id = "" }); this.lstLiveChannel_Follow_Category.ItemsSource = ds; } }
private void parseJSONLiveChannelList(String jsonLiveChannelList) { try { var liveChannelListJSONObj = JsonConvert.DeserializeObject <RootLiveChannelClass>(jsonLiveChannelList); if (liveChannelListJSONObj.success == true || liveChannelListJSONObj.type == "live_channel") { this.total_channel = Int32.Parse(liveChannelListJSONObj.total_quantity); listLiveChannel = new List <LiveChannelClass>(); foreach (var obj in liveChannelListJSONObj.items) { liveChannelObj = new LiveChannelClass(); liveChannelObj.live_channel_id = obj.live_channel_id; liveChannelObj.live_channel_folder = obj.live_channel_folder; liveChannelObj.live_channel_number_view = obj.live_channel_number_view; liveChannelObj.live_channel_title = obj.live_channel_title; liveChannelObj.live_channel_url = obj.live_channel_url; liveChannelObj.video_picture_path = obj.video_picture_path; listLiveChannel.Add(liveChannelObj); } this.numberVideoPerPage = Int16.Parse(liveChannelListJSONObj.quantity); this.numberVideo = Int16.Parse(liveChannelListJSONObj.total_quantity); } else { liveChannelObj = new LiveChannelClass(); liveChannelObj.live_channel_title = "Không có dữ liệu !"; this.numberVideoPerPage = 0; this.numberVideo = 0; } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }