private void ReplyToComment() { if (string.IsNullOrEmpty(replyEditTextBox.Text)) { if (_messageBoxIsShown) return; _messageBoxIsShown = true; MessageBox.Show(_localizedStrings.Messages.MissingReply); _messageBoxIsShown = false; replyEditTextBox.Focus(); return; } if (!App.isNetworkAvailable()) { Exception connErr = new NoConnectionException(); this.HandleException(connErr); return; } Blog currentBlog = App.MasterViewModel.CurrentBlog; Comment comment = DataContext as Comment; Comment reply = new Comment() { Author = currentBlog.Username, Parent = comment.CommentId, Content = replyEditTextBox.Text }; NewCommentRPC rpc = new NewCommentRPC(currentBlog, comment, reply); rpc.Completed += new XMLRPCCompletedEventHandler<Comment>(OnNewCommentRPCCompleted); rpc.ExecuteAsync(); _currentConnection = rpc; ApplicationBar.IsVisible = false; App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.ReplyingToComment); }
private void OnFetchCurrentBlogCommentsCompleted(object sender, XMLRPCCompletedEventArgs<Comment> args) { GetAllCommentsRPC rpc = sender as GetAllCommentsRPC; rpc.Completed -= OnFetchCurrentBlogCommentsCompleted; UIThread.Invoke(() => { ApplicationBar.IsVisible = true; App.WaitIndicationService.HideIndicator(); }); if (null == args.Error) { foreach (Comment comment in args.Items) { if (comment.CommentId == this.comment_id) { _currentComment = comment; DataContext = comment; } } if (_currentComment == null) { UIThread.Invoke(() => { MessageBox.Show("Could not load the comment!", _localizedStrings.Messages.Info, MessageBoxButton.OK); }); } } else { this.HandleException(args.Error); } UIThread.Invoke(() => { ChangeApplicationBarAppearance(); }); }