private void OnDeletePage() { // This can only be called on the UI thread in response to a user button click. // If that ever changed we might need to arrange locking for access to _inProcessOfSaving and _tasksToDoAfterSaving. Debug.Assert(!_view.InvokeRequired); if (_inProcessOfSaving) { // Somehow (BL-431) it's possible that a Save is still in progress when we start executing a delete page. // If this happens, to prevent crashes we need to let the Save complete before we go ahead with the delete. _tasksToDoAfterSaving.Add(OnDeletePage); return; } try { _inProcessOfDeleting = true; _domForCurrentPage = null; //prevent us trying to save it later, as the page selection changes _currentlyDisplayedBook.DeletePage(_pageSelection.CurrentSelection); _view.UpdatePageList(false); Logger.WriteEvent("Delete Page"); Analytics.Track("Delete Page"); } catch (Exception error) { ErrorReport.NotifyUserOfProblem(error, "Could not delete that page. Try quiting Bloom, run it again, and then attempt to delete the page again. And please click 'details' below and report this to us."); } finally { _inProcessOfDeleting = false; } }
private void OnDeletePage() { try { _inProcessOfDeleting = true; _domForCurrentPage = null; //prevent us trying to save it later, as the page selection changes _currentlyDisplayedBook.DeletePage(_pageSelection.CurrentSelection); _view.UpdatePageList(false); Logger.WriteEvent("Delete Page"); Analytics.Track("Delete Page"); } catch (Exception error) { Palaso.Reporting.ErrorReport.NotifyUserOfProblem(error, "Could not delete that page. Try quiting Bloom, run it again, and then attempt to delete the page again. And please click 'details' below and report this to us."); } finally { _inProcessOfDeleting = false; } }