SIL.FieldWorks.XWorks.InterestingTextList.SetInterestingTexts C# (CSharp) Method

SetInterestingTexts() public method

This routine is where InterlinMaster sends the results of running the IFilterTextsDialog. The list may include regular as well as scripture texts. We persist them separately because Scripture is excluded by default and regular texts are included by default. Thus, storing a list of the INCLUDED scripture means that originally, or if we clear all saved settings, NO scripture is included, and any newly created Scripture is also excluded until manually added. Storing a lis of EXCLUDED regular texts means that originally, or if we clear all saved settings, ALL regular texts are included, and if we add a new one, it is automatically included.
public SetInterestingTexts ( IEnumerable stTexts ) : void
stTexts IEnumerable
return void
		public void SetInterestingTexts(IEnumerable<IStText> stTexts)
		{
			var oldTexts = InterestingTexts.ToArray();
			m_scriptureTexts = new List<IStText>();
			var excludedGuids = new HashSet<Guid>(from obj in AllCoreTexts select obj.Guid);
			foreach (var obj in stTexts)
			{
				if (obj.Owner is IText)
					excludedGuids.Remove(obj.Guid);
				else
					m_scriptureTexts.Add(obj);
			}
			UpdatePropertyTable();
			UpdateExcludedCoreTexts(excludedGuids);
			m_coreTexts = null;
			m_interestingTests = null; // regenerate when next needed. (Before we raise changed, which may use it...)
			var newTexts = InterestingTexts.ToArray();
			int firstChange = 0;
			int minLength = Math.Min(oldTexts.Length, newTexts.Length);
			while (firstChange < minLength && newTexts[firstChange] == oldTexts[firstChange])
				firstChange++;
			int endMatchCount = 0;
			while (endMatchCount < minLength - firstChange && newTexts[newTexts.Length - endMatchCount - 1] == oldTexts[oldTexts.Length - endMatchCount - 1])
				endMatchCount++;
			// Enhance JohnT: could look for unchanged items in the list. But this is fairly rare,
			// typically when someone runs the configure dialog and OKs it.
			RaiseInterestingTextsChanged(firstChange, newTexts.Length - firstChange - endMatchCount, oldTexts.Length - firstChange - endMatchCount);
		}

Usage Example

Ejemplo n.º 1
0
 public void SetInterestingTexts(IEnumerable <IStText> newTexts)
 {
     m_interestingTexts.SetInterestingTexts(newTexts);
 }
All Usage Examples Of SIL.FieldWorks.XWorks.InterestingTextList::SetInterestingTexts