Example #1
0
 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("获取数据失败,请检查网络或重试");
     }
 }
Example #2
0
        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("获取数据失败,请检查网络或重试");
            }
        }
Example #3
0
        public PivotItemControl(ChannelInfo channelInfo)
        {
            channel           = channelInfo;
            pivotItem         = new PivotItem();
            pivotItem.Margin  = new Thickness(0, 10, 0, 0);
            pivotItem.Loaded += new System.Windows.RoutedEventHandler(PivotItem_Loaded);
            TextBlock textBlock = new TextBlock();

            textBlock.Text     = channelInfo.channelName;
            textBlock.FontSize = 35;
            textBlock.Width    = (channelInfo.channelName.Length == 2) ? 80 : 110;
            pivotItem.Header   = textBlock;
            scrollView         = new ChannelScrollView();
            scrollView.channel = channel;
            pivotItem.Content  = scrollView.scrollView;
        }