/// <summary>
/// Create or update the data div with all the data-book values in the document
/// </summary>
/// <param name="elementToReadFrom">This is either the whole document, or a page div that we just edited and want to read from.</param>
private void UpdateVariablesAndDataDiv(XmlNode elementToReadFrom)
{
Debug.WriteLine("before update: " + _dataDiv.OuterXml);
DataSet incomingData = SynchronizeDataItemsFromContentsOfElement(elementToReadFrom);
incomingData.UpdateGenericLanguageString("contentLanguage1", _collectionSettings.Language1Iso639Code, false);
incomingData.UpdateGenericLanguageString("contentLanguage2",
String.IsNullOrEmpty(MultilingualContentLanguage2)
? null
: MultilingualContentLanguage2, false);
incomingData.UpdateGenericLanguageString("contentLanguage3",
String.IsNullOrEmpty(MultilingualContentLanguage3)
? null
: MultilingualContentLanguage3, false);
//Debug.WriteLine("xyz: " + _dataDiv.OuterXml);
foreach (var v in incomingData.TextVariables)
{
if (!v.Value.IsCollectionValue)
{
UpdateSingleTextVariableThroughoutDOM(v.Key, v.Value.TextAlternatives);
}
}
Debug.WriteLine("after update: " + _dataDiv.OuterXml);
UpdateTitle(); //this may change our "bookTitle" variable if the title is based on a template that reads other variables (e.g. "Primer Term2-Week3")
}