/// <summary>
/// For some reason, we need to call this code OnIdle.
/// We couldn't figure out the timing any other way.
/// Otherwise, sometimes the calledByCSharp object doesn't exist; then we don't call restoreAccordionSettings.
/// If we don't call restoreAccordionSettings, then the more panel stays open without the checkboxes checked.
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void OnIdleAfterDocumentSupposedlyCompleted(object sender, EventArgs e)
{
System.Windows.Forms.Application.Idle -= OnIdleAfterDocumentSupposedlyCompleted;
//Work-around for BL-422: https://jira.sil.org/browse/BL-422
if (_currentlyDisplayedBook == null)
{
Debug.Fail(
"Debug Only: BL-422 reproduction (currentlyDisplayedBook was null in OnIdleAfterDocumentSupposedlyCompleted).");
Logger.WriteEvent("BL-422 happened just now (currentlyDisplayedBook was null in OnIdleAfterDocumentSupposedlyCompleted).");
return;
}
// listen for events raised by javascript
_view.AddMessageEventListener("saveAccordionSettingsEvent", SaveAccordionSettings);
_view.AddMessageEventListener("setModalStateEvent", SetModalState);
_view.AddMessageEventListener("preparePageForEditingAfterOrigamiChangesEvent", PreparePageForEditingAfterOrigamiChanges);
}