public SetInterestingTexts ( IEnumerable |
||
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);
}
public void SetInterestingTexts(IEnumerable <IStText> newTexts) { m_interestingTexts.SetInterestingTexts(newTexts); }