Bloom.Book.DataSet.UpdateGenericLanguageString C# (CSharp) Method

UpdateGenericLanguageString() public method

public UpdateGenericLanguageString ( string key, string value, bool isCollectionValue ) : void
key string
value string
isCollectionValue bool
return void
        public void UpdateGenericLanguageString(string key, string value, bool isCollectionValue)
        {
            var text = new MultiTextBase();
            text.SetAlternative("*", value);
            if(TextVariables.ContainsKey(key))
            {
                TextVariables.Remove(key);
            }
            TextVariables.Add(key, new NamedMutliLingualValue(text, isCollectionValue));
        }

Usage Example

Example #1
0
        /// <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")
        }
All Usage Examples Of Bloom.Book.DataSet::UpdateGenericLanguageString