private void OnTopicReplyAdded(object sender, AddTopicReplyEventArgs e) { FlickrGroup group = Cinderella.CinderellaCore.GroupCache[e.GroupId]; Topic topic = group.TopicCache[e.TopicId]; JObject rawJson = JObject.Parse(e.Response); string newReplyId = rawJson["reply"]["id"].ToString(); TopicReply newReply = new TopicReply(); newReply.ResourceId = newReplyId; newReply.Message = e.Message; newReply.Author = CurrentUser; newReply.CreationDate = DateTime.Now; topic.ReplyCache[newReplyId] = newReply; topic.Replies.Insert(0, newReply); topic.ReplyCount++; AddTopicReplyCompleteEventArgs evt = new AddTopicReplyCompleteEventArgs(); evt.SessionId = e.SessionId; evt.GroupId = group.ResourceId; evt.TopicId = topic.ResourceId; evt.newReply = newReply; AddTopicReplyCompleted.DispatchEvent(this, evt); }
private void OnAddReplyComplete(object sender, AddTopicReplyCompleteEventArgs e) { Dispatcher.BeginInvoke(() => { if (composer == null || e.SessionId != addReplySessionId) return; DismissComposerView(); ReplyCollection.Insert(1, e.newReply); }); }