private async void sendMarkButton_Click(object sender, RoutedEventArgs e) { try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (credentialList.Count > 0) { sendMarkButton.IsEnabled = false; sendMarkProgressRing.Visibility = Visibility.Visible; string id = ""; string type_id = ""; id = al[0].article_id.ToString(); type_id = "7"; List <KeyValuePair <String, String> > paramList = new List <KeyValuePair <String, String> >(); paramList.Add(new KeyValuePair <string, string>("article_id", id)); paramList.Add(new KeyValuePair <string, string>("type_id", type_id)); paramList.Add(new KeyValuePair <string, string>("stuNum", credentialList[0].UserName)); paramList.Add(new KeyValuePair <string, string>("idNum", credentialList[0].Password)); paramList.Add(new KeyValuePair <string, string>("content", sendMarkTextBox.Text)); paramList.Add(new KeyValuePair <string, string>("answer_user_id", "0")); string sendMark = await NetWork.getHttpWebRequest("cyxbsMobile/index.php/Home/ArticleRemark/postremarks", paramList); Debug.WriteLine(sendMark); try { if (sendMark != "") { JObject obj = JObject.Parse(sendMark); if (Int32.Parse(obj["state"].ToString()) == 200) { Utils.Toast("评论成功"); sendMarkTextBox.Text = ""; rl.Clear(); GetRemark(); int temp = int.Parse(al[0].remark_num); al[0].remark_num = (++temp).ToString(); } else { Utils.Toast("评论失败"); } } else { Utils.Toast("评论失败"); } sendMarkProgressRing.Visibility = Visibility.Collapsed; } catch (Exception) { } } else { var msgPopup = new Data.loginControl("您还没有登录 无法评论帖子~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先四处逛一逛~"); }; msgPopup.ShowWIndow(); } } catch { var msgPopup = new Data.loginControl("您还没有登录 无法评论帖子~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先四处逛一逛~"); }; msgPopup.ShowWIndow(); } }
private async void LikeButton_Click(object sender, RoutedEventArgs e) { //TODO:未登陆时 不能点赞 //if (appSetting.Values.ContainsKey("idNum")) try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (credentialList.Count > 0) { var b = sender as Button; string num_id = b.TabIndex.ToString(); Debug.WriteLine(num_id); Debug.WriteLine("id " + num_id.Substring(2)); string like_num = ""; if (ViewModel.BBDD != null) { BBDDFeed bbddfeed = ViewModel.BBDD; if (bbddfeed.is_my_like == "true" || bbddfeed.is_my_like == "True") { like_num = await CommunityFeedsService.setPraise(bbddfeed.type_id, num_id.Substring(2), false); if (like_num != "") { bbddfeed.like_num = like_num; bbddfeed.is_my_like = "false"; //if (args is HotFeed) //{ // HotFeed h = args as HotFeed; // h.like_num = like_num; // h.is_my_Like = "false"; //} } } else { like_num = await CommunityFeedsService.setPraise(bbddfeed.type_id, num_id.Substring(2), true); if (like_num != "") { bbddfeed.like_num = like_num; bbddfeed.is_my_like = "true"; //if (args is HotFeed) //{ // HotFeed h = args as HotFeed; // h.like_num = like_num; // h.is_my_Like = "true"; //} } } } if (ViewModel.hotfeed != null) { HotFeed hotfeed = ViewModel.hotfeed; if (hotfeed.is_my_Like == "true" || hotfeed.is_my_Like == "True") { like_num = await CommunityFeedsService.setPraise(hotfeed.type_id, num_id.Substring(2), false); if (like_num != "") { hotfeed.like_num = like_num; hotfeed.is_my_Like = "false"; //if (args is HotFeed) //{ // HotFeed h = args as HotFeed; // h.like_num = like_num; // h.is_my_Like = "false"; //} } } else { like_num = await CommunityFeedsService.setPraise(hotfeed.type_id, num_id.Substring(2), true); if (like_num != "") { hotfeed.like_num = like_num; hotfeed.is_my_Like = "true"; //if (args is HotFeed) //{ // HotFeed h = args as HotFeed; // h.like_num = like_num; // h.is_my_Like = "true"; //} } } } } else { var msgPopup = new Data.loginControl("您还没有登录 无法点赞~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先四处逛一逛~"); }; msgPopup.ShowWIndow(); } } catch { var msgPopup = new Data.loginControl("您还没有登录 无法点赞~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先四处逛一逛~"); }; msgPopup.ShowWIndow(); } }
private async void sendMarkButton_Click(object sender, RoutedEventArgs e) { //TODO:未登陆时 不能评论 //if (appSetting.Values.ContainsKey("idNum")) try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (credentialList.Count > 0) { sendMarkButton.IsEnabled = false; sendMarkProgressRing.Visibility = Visibility.Visible; string id = ""; string type_id = ""; if (ViewModel.BBDD != null) { id = ViewModel.BBDD.id; type_id = ViewModel.BBDD.type_id; } else { id = ViewModel.hotfeed.article_id; type_id = ViewModel.hotfeed.type_id; } List <KeyValuePair <String, String> > paramList = new List <KeyValuePair <String, String> >(); paramList.Add(new KeyValuePair <string, string>("article_id", id)); paramList.Add(new KeyValuePair <string, string>("type_id", type_id)); //paramList.Add(new KeyValuePair<string, string>("stuNum", appSetting.Values["stuNum"].ToString())); //paramList.Add(new KeyValuePair<string, string>("idNum", appSetting.Values["idNum"].ToString())); paramList.Add(new KeyValuePair <string, string>("stuNum", credentialList[0].UserName)); paramList.Add(new KeyValuePair <string, string>("idNum", credentialList[0].Password)); paramList.Add(new KeyValuePair <string, string>("content", sendMarkTextBox.Text)); paramList.Add(new KeyValuePair <string, string>("answer_user_id", Mark2PeoNum)); string sendMark = await NetWork.getHttpWebRequest("cyxbsMobile/index.php/Home/ArticleRemark/postremarks", paramList); Debug.WriteLine(sendMark); try { if (sendMark != "") { JObject obj = JObject.Parse(sendMark); if (Int32.Parse(obj["state"].ToString()) == 200) { Utils.Toast("评论成功"); issend = true; sendMarkTextBox.Text = ""; markList.Clear(); remarkPage = 0; getMark(); if (type_id == "6") { ViewModel.hotfeed.remark_num = (int.Parse(ViewModel.hotfeed.remark_num) + 1).ToString(); } } else { Utils.Toast("评论失败"); } } else { Utils.Toast("评论失败"); } sendMarkProgressRing.Visibility = Visibility.Collapsed; } catch (Exception) { } isMark2Peo = false; } else { var msgPopup = new Data.loginControl("您还没有登录 无法评论帖子~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先四处逛一逛~"); }; msgPopup.ShowWIndow(); } } catch { var msgPopup = new Data.loginControl("您还没有登录 无法评论帖子~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先四处逛一逛~"); }; msgPopup.ShowWIndow(); } }
private async void sendMarkButton_Click(object sender, RoutedEventArgs e) { //TODO:未登陆时 不能评论 //if (appSetting.Values.ContainsKey("idNum")) try { var vault = new Windows.Security.Credentials.PasswordVault(); var credentialList = vault.FindAllByResource(resourceName); credentialList[0].RetrievePassword(); if (credentialList.Count > 0) { sendMarkButton.IsEnabled = false; sendMarkProgressRing.Visibility = Visibility.Visible; string id = ""; string type_id = ""; if (ViewModel.BBDD != null) { id = ViewModel.BBDD.id; type_id = ViewModel.BBDD.type_id; } else { id = ViewModel.hotfeed.article_id; type_id = ViewModel.hotfeed.type_id; } List<KeyValuePair<String, String>> paramList = new List<KeyValuePair<String, String>>(); paramList.Add(new KeyValuePair<string, string>("article_id", id)); paramList.Add(new KeyValuePair<string, string>("type_id", type_id)); //paramList.Add(new KeyValuePair<string, string>("stuNum", appSetting.Values["stuNum"].ToString())); //paramList.Add(new KeyValuePair<string, string>("idNum", appSetting.Values["idNum"].ToString())); paramList.Add(new KeyValuePair<string, string>("stuNum", credentialList[0].UserName)); paramList.Add(new KeyValuePair<string, string>("idNum", credentialList[0].Password)); paramList.Add(new KeyValuePair<string, string>("content", sendMarkTextBox.Text)); paramList.Add(new KeyValuePair<string, string>("answer_user_id", Mark2PeoNum)); string sendMark = await NetWork.getHttpWebRequest("cyxbsMobile/index.php/Home/ArticleRemark/postremarks", paramList); Debug.WriteLine(sendMark); try { if (sendMark != "") { JObject obj = JObject.Parse(sendMark); if (Int32.Parse(obj["state"].ToString()) == 200) { Utils.Toast("评论成功"); issend = true; sendMarkTextBox.Text = ""; markList.Clear(); remarkPage = 0; getMark(); if (type_id == "6") ViewModel.hotfeed.remark_num = (int.Parse(ViewModel.hotfeed.remark_num) + 1).ToString(); } else { Utils.Toast("评论失败"); } } else { Utils.Toast("评论失败"); } sendMarkProgressRing.Visibility = Visibility.Collapsed; } catch (Exception) { } isMark2Peo = false; } else { var msgPopup = new Data.loginControl("您还没有登录 无法评论帖子~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先四处逛一逛~"); }; msgPopup.ShowWIndow(); } } catch { var msgPopup = new Data.loginControl("您还没有登录 无法评论帖子~"); msgPopup.LeftClick += (s, c) => { Frame rootFrame = Window.Current.Content as Frame; rootFrame.Navigate(typeof(LoginPage)); }; msgPopup.RightClick += (s, c) => { new MessageDialog("您可以先四处逛一逛~"); }; msgPopup.ShowWIndow(); } }