private async Task Dispaly(int m)//将反序列化之后的类的内容显示到屏幕上
        {
            travellists_uri = "http://apis.baidu.com/qunartravel/travellist/travellist?" + "query=" + App.travellists_query + "&" + "page=" + now_page.ToString();
            try
            {
                travellists_json = await get_resquest.Get_Resquset_Result(new Uri(travellists_uri));  //网络请求拿到Json

                travellists_json = ConvertUnicodeToChinese.ConvertToChinese_Result(travellists_json); //内容转码
                ReFresh_List(travellists_json, m);                                                    //加载游记内容
                now_page++;
                prs.Visibility = Visibility.Collapsed;                                                //隐藏加载下一页新闻内容时显示的进度条
            }
            catch (Exception)
            {
                var dig      = new MessageDialog("可能你的网络有问题哦", "刷呀游记");
                var btnRetry = new UICommand("等会再试吧");
                dig.Commands.Add(btnRetry);
                var result = await dig.ShowAsync();

                if (null != result && result.Label == "等会再试吧")
                {
                    Search_Box.Focus(FocusState.Programmatic);
                    return;
                }
                throw;
            }
        }
        private async void Search()//搜索游记
        {
            try
            {
                #region 初始化搜索
                App.travellists_query = Search_Box.Text;
                now_page = 1;
                #endregion

                await Dispaly(0);//加载游记内容
            }
            catch (Exception)
            {
                var dig      = new MessageDialog("可能你的网络有问题哦", "错误的那点事");
                var btnRetry = new UICommand("等会再试吧");
                dig.Commands.Add(btnRetry);
                var result = await dig.ShowAsync();

                if (null != result && result.Label == "等会再试吧")
                {
                    Search_Box.Focus(FocusState.Programmatic);
                }
                throw;
            }
        }
Exemple #3
0
        private async Task Dispaly(int m)//将反序列化之后的类的内容显示到屏幕上
        {
            news_uri = "http://apis.baidu.com/showapi_open_bus/channel_news/search_news?" + "channelName=" + App.news_channel_name + "&" + "title=" + App.news_title + "&" + "page=" + now_page.ToString();
            try
            {
                news_json = await get_resquest.Get_Resquset_Result(new Uri(news_uri));  //网络请求拿到Json

                news_json = ConvertUnicodeToChinese.ConvertToChinese_Result(news_json); //内容转码
                ReFresh_List(news_json, m);                                             //加载新闻内容
                now_page++;
                prs.Visibility = Visibility.Collapsed;                                  //隐藏加载下一页新闻内容时显示的进度条
            }
            catch (Exception)
            {
                var dig      = new MessageDialog("可能你的网络有问题哦", "刷呀新闻");
                var btnRetry = new UICommand("等会再试吧");
                dig.Commands.Add(btnRetry);
                var result = await dig.ShowAsync();

                if (null != result && result.Label == "等会再试吧")
                {
                    Search_Box.Focus(FocusState.Programmatic);
                    return;
                }
                throw;
            }
        }