Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 23 additions & 5 deletions Src/xWorks/InterestingTextsDecorator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public class InterestingTextsDecorator : DomainDataByFlidDecoratorBase, ISetMedi
// The object our property belongs to. We consider any object for which we are asked our special
// property to be the root object.
private int m_rootHvo;
private Mediator m_mediator;
private PropertyTable m_propertyTable;

public InterestingTextsDecorator(ISilDataAccessManaged domainDataByFlid, XmlNode configurationNode,
ILcmServiceLocator services)
: base(domainDataByFlid)
Expand Down Expand Up @@ -55,6 +58,8 @@ public override void RemoveNotification(IVwNotifyChange nchng)
// If a clerk were to be disposed some other time when another clerk was still using the ITL,
// this would be a bad thing to do.
base.RemoveNotification(m_interestingTexts);
m_interestingTexts = null;
m_interestingHvos = null;
}
}

Expand All @@ -66,8 +71,21 @@ public override void AddNotification(IVwNotifyChange nchng)

public void SetMediator(Mediator mediator, PropertyTable propertyTable)
{
m_interestingTexts = GetInterestingTextList(mediator, propertyTable, m_services);
EnsureInterestingTextsSubscription();
m_mediator = mediator;
m_propertyTable = propertyTable;
}

private InterestingTextList InterestingTexts
{
get
{
if (m_interestingTexts == null)
{
m_interestingTexts = GetInterestingTextList(m_mediator, m_propertyTable, m_services);
EnsureInterestingTextsSubscription();
}
return m_interestingTexts;
}
}

private void EnsureInterestingTextsSubscription()
Expand Down Expand Up @@ -132,7 +150,7 @@ int[] GetInterestingTexts()
// m_interestingHvos = new int[0];
// return m_interestingHvos;
//}
m_interestingHvos = (from text in m_interestingTexts.InterestingTexts select text.Hvo).ToArray();
m_interestingHvos = (from text in InterestingTexts.InterestingTexts select text.Hvo).ToArray();
}
return m_interestingHvos;
}
Expand Down Expand Up @@ -161,12 +179,12 @@ public override int get_VecItem(int hvo, int tag, int index)

public IEnumerable<IStText> ScriptureTexts
{
get { return m_interestingTexts.ScriptureTexts; }
get { return InterestingTexts.ScriptureTexts; }
}

public void SetInterestingTexts(IEnumerable<IStText> newTexts)
{
m_interestingTexts.SetInterestingTexts(newTexts);
InterestingTexts.SetInterestingTexts(newTexts);
}

public override int get_VecSize(int hvo, int tag)
Expand Down
Loading