void OnPageSelectionChanged(object sender, EventArgs e) { Logger.WriteMinorEvent("changing page selection"); Analytics.Track("Select Page"); //not "edit page" because at the moment we don't have the capability of detecting that. if (_view != null) { if (_previouslySelectedPage != null && _domForCurrentPage != null) { if (!_inProcessOfDeleting) //this is a mess.. before if you did a delete and quickly selected another page, events transpired such that you're now trying to save a deleted page { SaveNow(); } _view.UpdateThumbnailAsync(_previouslySelectedPage); } _previouslySelectedPage = _pageSelection.CurrentSelection; _view.UpdateSingleDisplayedPage(_pageSelection.CurrentSelection); _deletePageCommand.Enabled = !_pageSelection.CurrentSelection.Required; } GC.Collect(); //i put this in while looking for memory leaks, feel free to remove it. }