private void Search() { List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >(); this.Dispatcher.Invoke(() => { reportsList.Children.Clear(); parameters.Add(new KeyValuePair <string, string>("Page", 0 + "")); }); string result = Request.Request.RequestData("/Report/get", parameters); JArray arrays = Utils.Utils.StringToJsonArray(result); for (int i = 0; i < arrays.Count; i++) { Report report = Report.JsonToReport((JObject)arrays[i]); parameters = new List <KeyValuePair <string, string> >(); this.Dispatcher.Invoke(() => { reportsList.Children.Clear(); parameters.Add(new KeyValuePair <string, string>("ID", report.OpinionID + "")); }); Opinion opinion = Opinion.JsonToOpinion(Utils.Utils.StringToJsonObject(Request.Request.RequestData("/Opinion/get", parameters))); parameters = new List <KeyValuePair <string, string> >(); this.Dispatcher.Invoke(() => { reportsList.Children.Clear(); parameters.Add(new KeyValuePair <string, string>("Mail", report.Mail)); }); User userReporter = User.JsonToUser(Utils.Utils.StringToJsonObject(Request.Request.RequestData("/User/getUser", parameters))); this.Dispatcher.Invoke(() => { reportsList.Children.Clear(); parameters.Add(new KeyValuePair <string, string>("Mail", opinion.User_Mail)); }); User userReported = User.JsonToUser(Utils.Utils.StringToJsonObject(Request.Request.RequestData("/User/getUser", parameters))); this.Dispatcher.Invoke(() => { ReportButton rb = new ReportButton(report, opinion, userReporter, userReported, this); reportsList.Children.Add(rb); }); } }
private void GetComments(Place p) { List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >(); this.Dispatcher.Invoke(() => { parameters.Add(new KeyValuePair <string, string>("PlaceID", p.ID + "")); parameters.Add(new KeyValuePair <string, string>("Page", 0 + "")); }); string result = Request.Request.RequestData("/Opinion/returnOpinions", parameters); JArray arrays = Utils.Utils.StringToJsonArray(result); for (int i = 0; i < arrays.Count; i++) { Opinion opinion = Opinion.JsonToOpinion((JObject)arrays[i]); this.Dispatcher.Invoke(() => { OpinionControl oc = new OpinionControl(opinion); comments.Children.Add(oc); }); } }