void OnProjectBackendChanged(ApplicationBackend oldBackend)
{
if (++reloadCount == 2)
{
object sessionData = null;
if (oldBackend != null && !autoCommitChanges)
{
sessionData = session.SaveState();
session.DestroyWrapperWidgetPlug();
}
// Don't dispose the session here, since it will dispose
// the underlying project, and we can't do it because
// it may need to process the OnBackendChanging event
// as well.
CreateSession();
if (sessionData != null && session != null)
{
session.RestoreState(sessionData);
}
base.OnBackendChanged(oldBackend);
NotifyRootWidgetChanged();
}
}