private void LoadChannelCompleted(IAsyncResult ar) { string result = HttpHelper.SyncResultTostring(ar); if (result != null) { channelDetailResult channelDetails = null; try { channelDetails = JsonConvert.DeserializeObject <channelDetailResult>(result); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("LoadChannelCompleted json 解析错误" + ex.Message); } if (channelDetails != null && channelDetails.err_code == HttpHelper.rightCode) { this.Dispatcher.BeginInvoke(() => { ChannelScrollView scrollView = new ChannelScrollView(); MainGrid.Children.Clear(); MainGrid.Children.Add(scrollView.scrollView); scrollView.LoadChannelDetail(channelDetails.data); }); } } else { // App.ShowToast("获取数据失败,请检查网络或重试"); } }
private void LoadRankChannelCompleted(IAsyncResult ar) { string result = HttpHelper.SyncResultTostring(ar); if (result != null) { channelDetailResult channelDetails = null; try { channelDetails = JsonConvert.DeserializeObject <channelDetailResult>(result); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("LoadChannelCompleted json 解析错误" + ex.Message); } if (channelDetails != null && channelDetails.err_code == HttpHelper.rightCode) { rankListLoadSucc = true; CallbackManager.currentPage.Dispatcher.BeginInvoke(() => { RankListBox.Visibility = System.Windows.Visibility.Visible; List <ChannelTemplate> rankListData = new List <ChannelTemplate>(); foreach (ChannelDetail channelDatail in channelDetails.data) { rankListData.AddRange(channelDatail.templateData); } RankListBox.ItemsSource = rankListData; }); } } else { if (CommonData.NetworkStatus != "None") { App.ShowToast("获取数据失败,请检查网络或重试"); } CallbackManager.currentPage.Dispatcher.BeginInvoke(() => { App.HideLoading(); RankLoadGrid.Visibility = System.Windows.Visibility.Visible; //RankLoadGrid.Tap -= new EventHandler<System.Windows.Input.GestureEventArgs>(ReloadRankDataTap); //RankLoadGrid.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(ReloadRankDataTap); RankListBox.Visibility = System.Windows.Visibility.Collapsed; }); } }
private void LoadChannelCompleted(IAsyncResult ar) { string result = HttpHelper.SyncResultTostring(ar); if (result != null) { channelDetailResult channelDetails = null; try { channelDetails = JsonConvert.DeserializeObject <channelDetailResult>(result); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("LoadChannelCompleted json 解析错误" + ex.Message); } if (channelDetails != null && channelDetails.err_code == HttpHelper.rightCode) { CallbackManager.currentPage.Dispatcher.BeginInvoke(() => { AllChannelData = channelDetails.data; scrollView.LoadChannelDetail(AllChannelData); scrollView.HideReload(); App.HideLoading(); LoadedComplete = true; }); } } else { //if (CommonData.NetworkStatus != "None") //{ // App.ShowToast("获取数据失败,请检查网络或重试"); //} CallbackManager.currentPage.Dispatcher.BeginInvoke(() => { scrollView.loadGrid.Tap -= new EventHandler <System.Windows.Input.GestureEventArgs>(ReloadData); scrollView.loadGrid.Tap += new EventHandler <System.Windows.Input.GestureEventArgs>(ReloadData); App.HideLoading(); scrollView.ShowReload(); }); } }
private void LoadSiftChannelCompleted(IAsyncResult ar) { string result = HttpHelper.SyncResultTostring(ar); if (result != null) { channelDetailResult channelDetails = null; try { channelDetails = JsonConvert.DeserializeObject <channelDetailResult>(result); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("LoadChannelCompleted json 解析错误" + ex.Message); } if (channelDetails != null && channelDetails.err_code == HttpHelper.rightCode) { siftListLoadSucc = true; CallbackManager.currentPage.Dispatcher.BeginInvoke(() => { SiftLLs.Visibility = System.Windows.Visibility.Visible; List <VideoViewModel> TemplateListData = new List <VideoViewModel>(); foreach (ChannelDetail channelDatail in channelDetails.data) { switch (channelDatail.type) { case "normalAvatorText": case "normalLandScape": case "roundAvatorText": case "tvPortrait": for (int i = 0; i < channelDatail.templateData.Count; i = i + 2) { if (channelDatail.templateData.Count > i + 1) { ChannelTemplate template1 = channelDatail.templateData[i]; ChannelTemplate template2 = channelDatail.templateData[i + 1]; VideoViewModel videoData = new VideoViewModel { //stupid func type = channelDatail.type, name = template1.name, jumpType = template1.jumpType, picUrl = template1.picUrl, tag = template1.tag, desc = template1.desc, videoId = template1.videoId, webUrl = template1.webUrl, playUrl = template1.playUrl, subjectId = template1.subjectId, name1 = template2.name, picUrl1 = template2.picUrl, tag1 = template2.tag, desc1 = template2.desc, videoId1 = template2.videoId, jumpType1 = template1.jumpType, webUrl1 = template2.webUrl, playUrl1 = template2.playUrl, subjectId1 = template2.subjectId, }; TemplateListData.Add(videoData); } else { ChannelTemplate template1 = channelDatail.templateData[i]; VideoViewModel videoData = new VideoViewModel { type = channelDatail.type, name = template1.name, jumpType = template1.jumpType, picUrl = template1.picUrl, tag = template1.tag, desc = template1.desc, videoId = template1.videoId, webUrl = template1.webUrl, playUrl = template1.playUrl, subjectId = template1.subjectId, }; TemplateListData.Add(videoData); } } break; default: break; } foreach (ChannelTemplate template in channelDatail.templateData) { switch (channelDatail.type) { case "banner": case "largeLandScapeNodesc": case "largeLandScape": case "normalLandScapeNodesc": case "aceSeason": case "title": case "rankList": case "live": break; case "normalAvatorText": case "normalLandScape": case "roundAvatorText": case "tvPortrait": case "unknowModType1": case "unknowModType2": continue; default: continue; } VideoViewModel videoData = new VideoViewModel { type = channelDatail.type, //width = width, //hight = height, name = template.name, jumpType = template.jumpType, subjectId = template.subjectId, picUrl = template.picUrl, playUrl = template.playUrl, tag = template.tag, desc = template.desc, videoId = template.videoId, hotDegree = template.hotDegree, webUrl = template.webUrl, rank = template.rank }; TemplateListData.Add(videoData); } } SiftLLs.ItemsSource = TemplateListData; }); } } else { if (CommonData.NetworkStatus != "None") { App.ShowToast("获取数据失败,请检查网络或重试"); } CallbackManager.currentPage.Dispatcher.BeginInvoke(() => { siftLoadGrid.Visibility = System.Windows.Visibility.Visible; App.HideLoading(); //siftLoadGrid.Tap -= new EventHandler<System.Windows.Input.GestureEventArgs>(ReloadSiftDataTap); //siftLoadGrid.Tap += new EventHandler<System.Windows.Input.GestureEventArgs>(ReloadSiftDataTap); SiftLLs.Visibility = System.Windows.Visibility.Collapsed; }); } }