AutoWikiBrowser.MainForm.DeleteArticle C# (CSharp) Method

DeleteArticle() private method

private DeleteArticle ( ) : void
return void
        private void DeleteArticle()
        {
            if (TheArticle == null)
            {
                DisableButtons();
                return;
            }

            try
            {
                if (!TheSession.Page.Exists)
                {
                    MessageBox.Show("Cannot delete a non-existent page");
                    return;
                }

                if (!TheSession.User.CanDeletePage(TheSession.Page))
                {
                    MessageBox.Show(
                        "Current user doesn't have enough rights to delete \"" + TheSession.Page.Title + "\"",
                        "User rights not sufficient");
                    return;
                }

                string msg;
                bool succeed = TheArticle.Delete(TheSession);

                if (succeed)
                {
                    msg = "Deleted " + TheArticle.Name;
                    listMaker.Remove(TheArticle);
                }
                else
                    msg = "Deletion of " + TheArticle.Name + " failed!";

                StatusLabelText = msg;
                articleActionLogControl1.LogArticleAction(TheArticle.Name, succeed, ArticleAction.Delete, msg);
            }
            catch (ApiErrorException ae)
            {
                if (ae.ErrorCode == "missingtitle")
                {
                    StatusLabelText = "Article already deleted";
                    listMaker.Remove(TheArticle);

                    articleActionLogControl1.LogArticleAction(TheArticle.Name, false, ArticleAction.Delete,
                                                              "Article already deleted");
                    return;
                }

                if (ae.ErrorCode == "bigdelete")
                {
                    StatusLabelText = "You can't delete this page because it has more than 5,000 revisions";
                    listMaker.Remove(TheArticle);

                    articleActionLogControl1.LogArticleAction(TheArticle.Name, false, ArticleAction.Delete,
                                                              "Article can't be deleted");
                    return;
                }
                ErrorHandler.HandleException(ae);
            }
            catch (Exception ex)
            {
                ErrorHandler.HandleException(ex);
            }
        }
MainForm