本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.TryGetHashtable方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.TryGetHashtable方法的具体用法?C# FdoCache.TryGetHashtable怎么用?C# FdoCache.TryGetHashtable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.FdoCache
的用法示例。
在下文中一共展示了FdoCache.TryGetHashtable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReplaceReferencesToParagraph
/// ------------------------------------------------------------------------------------
/// <summary>
/// Replaces all references to one paragraph in the footnote cache with another. Used to
/// update the cache when a paragraph is being merged with another.
/// </summary>
/// <param name="cache"></param>
/// <param name="oldParaHvo">id of paragraph being merged into another</param>
/// <param name="newParaHvo">id of paragraph surviving the merge</param>
/// ------------------------------------------------------------------------------------
public static void ReplaceReferencesToParagraph(FdoCache cache, int oldParaHvo, int newParaHvo)
{
int bookHvo = cache.GetOwnerOfObjectOfClass(oldParaHvo, (int)ScrBook.kclsidScrBook);
if (bookHvo <= 0)
{
Debug.Fail("Footnotes have to be contained in paragraphs owned by books.");
return;
}
Guid bookGuid = cache.GetGuidFromId(bookHvo);
Dictionary<int, FootnoteHashEntry> dict;
// Don't bother on empty cache - it will be created when needed. Need to use HVO to get
// GUID so we don't create the book and potentially cause the refresh routine to be called.
if (!cache.TryGetHashtable<int, FootnoteHashEntry>(bookGuid, out dict) || dict.Count == 0)
return;
foreach (FootnoteHashEntry entry in dict.Values)
{
if (entry.HvoPara == oldParaHvo)
entry.HvoPara = newParaHvo;
}
}
示例2: RefreshCacheForParagraph
/// ------------------------------------------------------------------------------------
/// <summary>
/// Refreshes cache for all footnotes in the StText containing the paragraph. We only
/// use this method when verses of a paragraph are changed - this will only happen on
/// content paragraphs of a ScrSection.
/// </summary>
/// <param name="cache"></param>
/// <param name="hvoObj"></param>
/// ------------------------------------------------------------------------------------
internal static void RefreshCacheForParagraph(FdoCache cache, int hvoObj)
{
int hvoPara = hvoObj;
if (cache.GetClassOfObject(hvoObj) == CmTranslation.kClassId)
hvoPara = cache.GetOwnerOfObject(hvoObj);
int hvoText = cache.GetOwnerOfObject(hvoPara);
IStText text = new StText(cache, hvoText);
ScrSection section = new ScrSection(cache, text.OwnerHVO);
BCVRef verseRef = new BCVRef(section.VerseRefStart);
Dictionary<int, FootnoteHashEntry> dict;
// Don't bother on empty cache - it will be created when needed. Need to use HVO to get GUID so we
// don't create the book and potentially cause the refresh routine to be called.
Guid bookGuid = cache.GetGuidFromId(section.OwnerHVO);
if (!cache.TryGetHashtable<int, FootnoteHashEntry>(bookGuid, out dict) ||
dict.Count == 0)
{
return;
}
AddFootnoteRefsInText(text, dict, ref verseRef);
}