private void OnPopularTagsReturned(object sender, PopularTagListUpdatedEventArgs e) { Dispatcher.BeginInvoke(() => { TagListView.Children.Clear(); foreach (PhotoTag tag in e.Tags) { WeightedTagButton button = new WeightedTagButton(); button.TagSource = tag; TagListView.Children.Add(button); } LoadingView.Visibility = Visibility.Collapsed; TagListView.Visibility = Visibility.Visible; }); }
private void OnPopularTagListReturned(object sender, GetPopularTagListEventArgs e) { JObject rawJson = JObject.Parse(e.Response); JObject rootJson = (JObject)rawJson["hottags"]; List<PhotoTag> result = new List<PhotoTag>(); foreach (JObject json in rootJson["tag"]) { PhotoTag tag = new PhotoTag(); tag.Name = json["_content"].ToString(); tag.Weight = int.Parse(json["score"].ToString()); result.Add(tag); } PopularTagListUpdatedEventArgs evt = new PopularTagListUpdatedEventArgs(); evt.Tags = result; PopularTagsUpdated.DispatchEvent(this, evt); }