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.
// Trace memory usage in case it may be useful
MemoryManagement.CheckMemory(false, "switched page in edit", true);
if (_view != null)
{
if (_previouslySelectedPage != null && _domForCurrentPage != null)
{
_view.UpdateThumbnailAsync(_previouslySelectedPage);
}
_previouslySelectedPage = _pageSelection.CurrentSelection;
// BL-2339: remember last edited page
if (_previouslySelectedPage != null)
{
var idx = _previouslySelectedPage.GetIndex();
if (idx > -1)
_previouslySelectedPage.Book.UserPrefs.MostRecentPage = idx;
}
_pageSelection.CurrentSelection.Book.BringPageUpToDate(_pageSelection.CurrentSelection.GetDivNodeForThisPage());
_view.UpdateSingleDisplayedPage(_pageSelection.CurrentSelection);
_duplicatePageCommand.Enabled = !_pageSelection.CurrentSelection.Required;
_deletePageCommand.Enabled = !_pageSelection.CurrentSelection.Required;
}
GC.Collect();//i put this in while looking for memory leaks, feel free to remove it.
}