/// <summary> /// 在此页将要在 Frame 中显示时进行调用。 /// </summary> /// <param name="e">描述如何访问此页的事件数据。 /// 此参数通常用于配置页。</param> protected override void OnNavigatedTo(NavigationEventArgs e) { HardwareButtons.BackPressed += HardwareButtons_BackPressed;//注册重写后退按钮事件 UmengSDK.UmengAnalytics.TrackPageStart("AcceptOrReject"); dl = e.Parameter as DateLetter; ReadLetter(dl); this.DataContext = dl; if (dl.User_gender == 1) { GenderImage.Source = new BitmapImage(new Uri("ms-appx:///Assets/ic_man.png", UriKind.Absolute)); } else { GenderImage.Source = new BitmapImage(new Uri("ms-appx:///Assets/ic_woman.png", UriKind.Absolute)); } if (dl.User_date_status==0) { this.AorR.Text = "已拒绝"; CommandBar.Visibility=Visibility.Collapsed; } if (dl.User_date_status == 1) { this.AorR.Text = "已接受"; CommandBar.Visibility = Visibility.Collapsed; } if (dl.User_date_status == 2) { this.AorR.Text = "接不接受呢?"; CommandBar.Visibility = Visibility.Visible; } if (!dl.Content.Equals("报名了你的约")) { CommandBar.Visibility = Visibility.Collapsed; } }
private async void getLetter(int cc, int page = 1) { DateListProgressStackPanel.Visibility = Visibility.Visible; DateListFailedStackPanel.Visibility = Visibility.Collapsed; string content = ""; if (cc == 1) { List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>(); paramList.Add(new KeyValuePair<string, string>("uid", appSetting.Values["uid"].ToString())); paramList.Add(new KeyValuePair<string, string>("token", appSetting.Values["token"].ToString())); paramList.Add(new KeyValuePair<string, string>("page", page.ToString())); paramList.Add(new KeyValuePair<string, string>("size", "10")); content = Utils.ConvertUnicodeStringToChinese(await NetWork.getHttpWebRequest("/letter/getletter", paramList)); Debug.WriteLine("content" + content); } else if (cc == 2) content = App.CacheString; try { if (content != "") { JObject obj = JObject.Parse(content); if (Int32.Parse(obj["status"].ToString()) == 200) { JArray dateListArray = Utils.ReadJso(content); for (int i = 0; i < dateListArray.Count; i++) { DateLetter d = new DateLetter(); JObject jobj = (JObject)dateListArray[i]; d.GetAttribute(jobj); dl.Add(d); } if (dl.Count <= 10) this.letterListView.ItemsSource = dl; App.CacheString = content; DateListProgressStackPanel.Visibility = Visibility.Collapsed; DateListFailedStackPanel.Visibility = Visibility.Collapsed; } else { DateListProgressStackPanel.Visibility = Visibility.Collapsed; DateListFailedStackPanel.Visibility = Visibility.Visible; } } else { DateListProgressStackPanel.Visibility = Visibility.Collapsed; DateListFailedStackPanel.Visibility = Visibility.Visible; } } catch (Exception) { DateListProgressStackPanel.Visibility = Visibility.Collapsed; Debug.WriteLine("私信,列表网络异常"); DateListFailedStackPanel.Visibility = Visibility.Visible; } }
private async void ReadLetter(DateLetter dateLetter) { string content = ""; List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>(); paramList.Add(new KeyValuePair<string, string>("uid", appSetting.Values["uid"].ToString())); paramList.Add(new KeyValuePair<string, string>("token", appSetting.Values["token"].ToString())); paramList.Add(new KeyValuePair<string, string>("letter_id", dateLetter.Letter_id.ToString())); content = Utils.ConvertUnicodeStringToChinese(await NetWork.getHttpWebRequest("/letter/detailletter", paramList)); Debug.WriteLine("content" + content); }