public override void Trigger(EditableView.ClickPosition.Sources source, EditableView pnlView, Transaction transaction) { if (CurrentDocument.Count < 2) { return; } // deleting the last page would bugger things up completely // Only confirm with user if the page is not empty if (!CurrentPage.IsEmpty) { if (MessageBox.Show(Strings.Item("Confirm_DeletePage"), RootApplication.AppName, MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } } CurrentDocument.DeletePage(CurrentPageIndex, transaction); // Usually we will display the page following this one, which now has the same page index, unless there isn't one int newIndex = CurrentPageIndex; if (newIndex >= CurrentDocument.Count) { newIndex = CurrentDocument.Count - 1; } Editor.DisplayPage(newIndex); }