private void OnTabAboutToChange(TabChangedDetails details)
{
if (details.From == _view)
{
SaveNow();
_view.RunJavaScript("if (typeof(FrameExports) !=='undefined') {FrameExports.getPageFrameExports().disconnectForGarbageCollection();}");
// This bizarre behavior prevents BL-2313 and related problems.
// For some reason I cannot discover, switching tabs when focus is in the Browser window
// causes Bloom to get deactivated, which prevents various controls from working.
// Moreover, it seems (BL-2329) that if the user types Alt-F4 while whatever-it-is is active,
// things get into a very bad state indeed. So arrange to re-activate ourselves as soon as the dust settles.
_oldActiveForm = Form.ActiveForm;
Application.Idle += ReactivateFormOnIdle;
//note: if they didn't actually change anything, Chorus is not going to actually do a checkin, so this
//won't pollute the history
#if Chorus
_sendReceiver.CheckInNow(string.Format("Edited '{0}'", CurrentBook.TitleBestForUserDisplay));
#endif
}
}