Exemplo n.º 1
0
        private void JWListView_ItemClick(object sender, ItemClickEventArgs e)
        {


            JWList JWItem = new JWList(((JWList)e.ClickedItem).ID, ((JWList)e.ClickedItem).Title, ((JWList)e.ClickedItem).Date, ((JWList)e.ClickedItem).Read, ((JWList)e.ClickedItem).Content == null ? "加载中..." : ((JWList)e.ClickedItem).Content);

            Debug.WriteLine("JWListgrid.Width" + JWListgrid.Width);
            if (JWListgrid.Width == 400)
            {
                //JWBackAppBarButton.Visibility = Visibility.Collapsed;
                SystemNavigationManager.GetForCurrentView().BackRequested -= App_BackRequested;
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
                JWRefreshAppBarButton.Visibility = Visibility.Visible;
            }
            else
            {
                //JWBackAppBarButton.Visibility = Visibility.Visible;
                SystemNavigationManager.GetForCurrentView().BackRequested += App_BackRequested;
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                JWRefreshAppBarButton.Visibility = Visibility.Collapsed;
            }
            JWFrame.Visibility = Visibility.Visible;
            this.JWFrame.Navigate(typeof(JWContentPage), JWItem);
        }
        private void JiaowuListView_ItemClick(object sender, ItemClickEventArgs e)
        {
            JWList JWItem = new JWList(((JWList)e.ClickedItem).ID, ((JWList)e.ClickedItem).Title, ((JWList)e.ClickedItem).Date, ((JWList)e.ClickedItem).Read, ((JWList)e.ClickedItem).Content == null ? "加载中..." : ((JWList)e.ClickedItem).Content);

            this.Frame.Navigate(typeof(JWContentPage), JWItem);
        }
Exemplo n.º 3
0
        private async void initJWList(int page = 1)
        {
            JWListFailedStackPanel.Visibility = Visibility.Collapsed;
            JWListProgressStackPanel.Visibility = Visibility.Visible;
            List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>();
            paramList.Add(new KeyValuePair<string, string>("page", page.ToString()));
            string jw = await NetWork.getHttpWebRequest("api/jwNewsList", paramList);
            Debug.WriteLine("jw->" + jw);
            JWListProgressStackPanel.Visibility = Visibility.Collapsed;
            if (jw != "")
            {
                JObject obj = JObject.Parse(jw);
                if (Int32.Parse(obj["status"].ToString()) == 200)
                {
                    JArray JWListArray = Utils.ReadJso(jw);
                    JWListView.ItemsSource = JWList;

                    for (int i = 0; i < JWListArray.Count; i++)
                    {
                        int failednum = 0;
                        JWList JWitem = new JWList();
                        JWitem.GetListAttribute((JObject)JWListArray[i]);
                        List<KeyValuePair<String, String>> contentparamList = new List<KeyValuePair<String, String>>();
                        contentparamList.Add(new KeyValuePair<string, string>("id", JWitem.ID));
                        string jwContent = await NetWork.getHttpWebRequest("api/jwNewsContent", contentparamList);
                        Debug.WriteLine("jwContent->" + jwContent);
                        if (jwContent != "")
                        {
                            string JWContentText = jwContent.Replace("(\r?\n(\\s*\r?\n)+)", "\r\n");

                            JObject jwContentobj = JObject.Parse(JWContentText);
                            if (Int32.Parse(jwContentobj["status"].ToString()) == 200)
                            {
                                JWitem.Content = jwContentobj["data"]["content"].ToString();
                                while (JWitem.Content.StartsWith("\r\n "))
                                    JWitem.Content = JWitem.Content.Substring(3);
                                while (JWitem.Content.StartsWith("\r\n"))
                                    JWitem.Content = JWitem.Content.Substring(2);
                                while (JWitem.Content.StartsWith("\n\t"))
                                    JWitem.Content = JWitem.Content.Substring(2);
                                while (JWitem.Content.StartsWith("\n"))
                                    JWitem.Content = JWitem.Content.Substring(1);
                            }
                            else
                            {
                                JWitem.Content = "";
                                failednum++;
                            }
                        }
                        else
                        {
                            failednum++;
                            if (failednum < 2)
                            {
                                jwContent = await NetWork.getHttpWebRequest("api/jwNewsContent", contentparamList);
                                Debug.WriteLine("jwContent->" + jwContent);
                                if (jwContent != "")
                                {
                                    string JWContentText = jwContent.Replace("(\r?\n(\\s*\r?\n)+)", "\r\n");
                                    JObject jwContentobj = JObject.Parse(JWContentText);
                                    if (Int32.Parse(jwContentobj["status"].ToString()) == 200)
                                    {
                                        JWitem.Content = jwContentobj["data"]["content"].ToString();
                                        while (JWitem.Content.StartsWith("\r\n "))
                                            JWitem.Content = JWitem.Content.Substring(3);
                                        while (JWitem.Content.StartsWith("\r\n"))
                                            JWitem.Content = JWitem.Content.Substring(2);
                                        while (JWitem.Content.StartsWith("\n\t"))
                                            JWitem.Content = JWitem.Content.Substring(2);
                                        while (JWitem.Content.StartsWith("\n"))
                                            JWitem.Content = JWitem.Content.Substring(1);
                                    }
                                    else
                                    {
                                        JWitem.Content = "";
                                        failednum++;
                                    }
                                }
                            }
                        }
                        JWList.Add(new JWList { Title = JWitem.Title, Date = JWitem.Date, Read = JWitem.Read, Content = JWitem.Content, ID = JWitem.ID });
                        //setOpacity();
                    }
                    JWListView.ItemsSource = JWList;
                    continueJWGrid.Visibility = Visibility.Visible;
                }
                else
                {
                    JWListFailedStackPanel.Visibility = Visibility.Visible;
                    continueJWGrid.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                JWListFailedStackPanel.Visibility = Visibility.Visible;
                continueJWGrid.Visibility = Visibility.Collapsed;
            }
        }
Exemplo n.º 4
0
        private void JWListView_ItemClick(object sender, ItemClickEventArgs e)
        {


            JWList JWItem = new JWList(((JWList)e.ClickedItem).ID, ((JWList)e.ClickedItem).Title, ((JWList)e.ClickedItem).Date, ((JWList)e.ClickedItem).Read, ((JWList)e.ClickedItem).Content == null ? "加载中..." : ((JWList)e.ClickedItem).Content);

            Debug.WriteLine("JWListgrid.Width" + JWListgrid.Width);
            if (JWListgrid.Width != null && JWListgrid.Width == 400)
            {
                JWBackAppBarButton.Visibility = Visibility.Collapsed;
                JWRefreshAppBarButton.Visibility = Visibility.Visible;
            }
            else
            {
                JWBackAppBarButton.Visibility = Visibility.Visible;
                JWRefreshAppBarButton.Visibility = Visibility.Collapsed;
            }
            JWFrame.Visibility = Visibility.Visible;
            this.JWFrame.Navigate(typeof(JWContentPage), JWItem);
        }