Example #1
0
        private void EditComment()
        {
            if (string.IsNullOrEmpty(replyEditTextBox.Text))
            {
                if (_messageBoxIsShown)
                {
                    return;
                }
                _messageBoxIsShown = true;
                MessageBox.Show(_localizedStrings.Messages.MissingFields);
                _messageBoxIsShown = false;
                replyEditTextBox.Focus();
                return;
            }

            if (!App.isNetworkAvailable())
            {
                Exception connErr = new NoConnectionException();
                this.HandleException(connErr);
                return;
            }

            Comment comment = DataContext as Comment;

            comment.Content = replyEditTextBox.Text;

            EditCommentRPC rpc = new EditCommentRPC(App.MasterViewModel.CurrentBlog, comment);

            rpc.Completed += OnEditCommentRPCCompleted;
            rpc.ExecuteAsync();
            _currentConnection = rpc;

            ApplicationBar.IsVisible = false;
            App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.EditingComment);
        }
Example #2
0
        private void ReplyToComment()
        {
            if (string.IsNullOrEmpty(replyEditTextBox.Text))
            {
                MessageBox.Show(_localizedStrings.Messages.MissingReply);
                replyEditTextBox.Focus();
                return;
            }

            if (!App.isNetworkAvailable())
            {
                Exception connErr = new NoConnectionException();
                this.HandleException(connErr);
                return;
            }

            Comment comment = DataContext as Comment;

            Comment reply = new Comment()
            {
                Author  = this._currentBlog.Username,
                Parent  = comment.CommentId,
                Content = replyEditTextBox.Text
            };

            NewCommentRPC rpc = new NewCommentRPC(this._currentBlog, comment, reply);

            rpc.Completed += new XMLRPCCompletedEventHandler <Comment>(OnNewCommentRPCCompleted);
            rpc.ExecuteAsync();
            _currentConnection = rpc;

            ApplicationBar.IsVisible = false;
            App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.ReplyingToComment);
        }
Example #3
0
        private void OnDeleteIconButtonClick(object sender, EventArgs e)
        {
            if (!App.isNetworkAvailable())
            {
                Exception connErr = new NoConnectionException();
                this.HandleException(connErr);
                return;
            }
            string prompt = _localizedStrings.Prompts.ConfirmDeleteComment;

            if (_messageBoxIsShown)
            {
                return;
            }
            _messageBoxIsShown = true;
            MessageBoxResult result = MessageBox.Show(prompt, _localizedStrings.Prompts.Confirm, MessageBoxButton.OKCancel);

            _messageBoxIsShown = false;
            if (result == MessageBoxResult.OK)
            {
                Comment comment = DataContext as Comment;

                DeleteCommentRPC rpc = new DeleteCommentRPC(App.MasterViewModel.CurrentBlog, comment);
                rpc.Completed += OnDeleteCommentRPCCompleted;
                rpc.ExecuteAsync();
                _currentConnection = rpc;

                ApplicationBar.IsVisible = false;
                App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.DeletingComment);
            }
            else
            {
                return;
            }
        }
Example #4
0
        private void OnSpamIconButtonClick(object sender, EventArgs e)
        {
            if (!App.isNetworkAvailable())
            {
                Exception connErr = new NoConnectionException();
                this.HandleException(connErr);
                return;
            }
            string           prompt = _localizedStrings.Prompts.ConfirmMarkSpamComment;
            MessageBoxResult result = MessageBox.Show(prompt, _localizedStrings.Prompts.Confirm, MessageBoxButton.OKCancel);

            if (result == MessageBoxResult.OK)
            {
                Comment comment = DataContext as Comment;
                comment.CommentStatus = eCommentStatus.spam;

                EditCommentRPC rpc = new EditCommentRPC(this._currentBlog, comment);
                rpc.Completed += OnEditCommentRPCCompleted;
                rpc.ExecuteAsync();
                _currentConnection = rpc;

                ApplicationBar.IsVisible = false;
                App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.MarkingAsSpam);
            }
            else
            {
                return;
            }
        }
Example #5
0
        private void OnApproveIconButtonClick(object sender, EventArgs e)
        {
            if (!App.isNetworkAvailable())
            {
                Exception connErr = new NoConnectionException();
                this.HandleException(connErr);
                return;
            }
            Comment comment = DataContext as Comment;

            comment.CommentStatus = eCommentStatus.approve;

            EditCommentRPC rpc = new EditCommentRPC(App.MasterViewModel.CurrentBlog, comment);

            rpc.Completed += OnEditCommentRPCCompleted;
            rpc.ExecuteAsync();
            _currentConnection = rpc;

            ApplicationBar.IsVisible = false;
            App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.ApprovingComment);
        }
Example #6
0
 protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
 {
     if (App.WaitIndicationService.Waiting)
     {
         if (null != _currentConnection)
         {
             _currentConnection.IsCancelled = true;
             _currentConnection             = null;
         }
         App.WaitIndicationService.HideIndicator();
         ApplicationBar.IsVisible = true;
         ChangeApplicationBarAppearance();
         e.Cancel = true;
     }
     else if (Visibility.Visible == replyEditPanel.Visibility)
     {
         HideReplyEditPanel();
         e.Cancel = true;
     }
     else
     {
         base.OnBackKeyPress(e);
     }
 }
 protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
 {
     if (App.WaitIndicationService.Waiting)
     {
         if (null != _currentConnection)
         {
             _currentConnection.IsCancelled = true;
             _currentConnection = null;
         }
         App.WaitIndicationService.HideIndicator();
         ApplicationBar.IsVisible = true;
         ChangeApplicationBarAppearance();
         e.Cancel = true;
     }
     else if (Visibility.Visible == replyEditPanel.Visibility)
     {
         HideReplyEditPanel();
         e.Cancel = true;
     }
     else
     {
         base.OnBackKeyPress(e);
     }
 }
        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 OnUnapproveIconButtonClick(object sender, EventArgs e)
        {
            if (!App.isNetworkAvailable())
            {
                Exception connErr = new NoConnectionException();
                this.HandleException(connErr);
                return;
            }
            Comment comment = DataContext as Comment;
            comment.CommentStatus = eCommentStatus.hold;

            EditCommentRPC rpc = new EditCommentRPC(App.MasterViewModel.CurrentBlog, comment);
            rpc.Completed += OnEditCommentRPCCompleted;
            rpc.ExecuteAsync();
            _currentConnection = rpc;

            ApplicationBar.IsVisible = false;
            App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.UnapprovingComment);
        }
        private void OnSpamIconButtonClick(object sender, EventArgs e)
        {
            if (!App.isNetworkAvailable())
            {
                Exception connErr = new NoConnectionException();
                this.HandleException(connErr);
                return;
            }
            string prompt = _localizedStrings.Prompts.ConfirmMarkSpamComment;
            if (_messageBoxIsShown)
                return;
            _messageBoxIsShown = true;
            MessageBoxResult result = MessageBox.Show(prompt, _localizedStrings.Prompts.Confirm, MessageBoxButton.OKCancel);
            _messageBoxIsShown = false;
            if (result == MessageBoxResult.OK)
            {
                Comment comment = DataContext as Comment;
                comment.CommentStatus = eCommentStatus.spam;

                EditCommentRPC rpc = new EditCommentRPC(App.MasterViewModel.CurrentBlog, comment);
                rpc.Completed += OnEditCommentRPCCompleted;
                rpc.ExecuteAsync();
                _currentConnection = rpc;

                ApplicationBar.IsVisible = false;
                App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.MarkingAsSpam);
            }
            else
            {
                return;
            }
        }
        private void EditComment()
        {
            if (string.IsNullOrEmpty(replyEditTextBox.Text))
            {
                if (_messageBoxIsShown)
                    return;
                _messageBoxIsShown = true;
                MessageBox.Show(_localizedStrings.Messages.MissingFields);
                _messageBoxIsShown = false;
                replyEditTextBox.Focus();
                return;
            }

            if (!App.isNetworkAvailable())
            {
                Exception connErr = new NoConnectionException();
                this.HandleException(connErr);
                return;
            }

            Comment comment = DataContext as Comment;
            comment.Content = replyEditTextBox.Text;

            EditCommentRPC rpc = new EditCommentRPC(App.MasterViewModel.CurrentBlog, comment);
            rpc.Completed += OnEditCommentRPCCompleted;
            rpc.ExecuteAsync();
            _currentConnection = rpc;

            ApplicationBar.IsVisible = false;
            App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.EditingComment);
        }
        private void OnDeleteIconButtonClick(object sender, EventArgs e)
        {
            if (!App.isNetworkAvailable())
            {
                Exception connErr = new NoConnectionException();
                this.HandleException(connErr);
                return;
            }
            string prompt = _localizedStrings.Prompts.ConfirmDeleteComment;
            MessageBoxResult result = MessageBox.Show(prompt, _localizedStrings.Prompts.Confirm, MessageBoxButton.OKCancel);
            if (result == MessageBoxResult.OK)
            {
                Comment comment = DataContext as Comment;

                DeleteCommentRPC rpc = new DeleteCommentRPC(this._currentBlog, comment);
                rpc.Completed += OnDeleteCommentRPCCompleted;
                rpc.ExecuteAsync();
                _currentConnection = rpc;

                ApplicationBar.IsVisible = false;
                App.WaitIndicationService.ShowIndicator(_localizedStrings.Messages.DeletingComment);
            }
            else
            {
                return;
            }
        }