本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.GetOwnerOfObjectOfClass方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.GetOwnerOfObjectOfClass方法的具体用法?C# FdoCache.GetOwnerOfObjectOfClass怎么用?C# FdoCache.GetOwnerOfObjectOfClass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.FdoCache
的用法示例。
在下文中一共展示了FdoCache.GetOwnerOfObjectOfClass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetReversalIndexEntryWritingSystem
/// <summary>
/// Get the writing system for the given ReversalIndexEntry.
/// </summary>
/// <param name="cache"></param>
/// <param name="hvoObj"></param>
/// <param name="wsDefault"></param>
/// <returns></returns>
public static int GetReversalIndexEntryWritingSystem(FdoCache cache, int hvoObj, int wsDefault)
{
if (cache != null && hvoObj != 0)
{
IReversalIndex ri = null;
int clid = cache.GetClassOfObject(hvoObj);
switch (clid)
{
case ReversalIndex.kclsidReversalIndex:
ri = ReversalIndex.CreateFromDBObject(cache, hvoObj);
break;
case ReversalIndexEntry.kclsidReversalIndexEntry:
int hvoReversalIndex = cache.GetOwnerOfObjectOfClass(hvoObj, ReversalIndex.kclsidReversalIndex);
if (hvoReversalIndex > 0)
ri = ReversalIndex.CreateFromDBObject(cache, hvoReversalIndex);
break;
case PartOfSpeech.kclsidPartOfSpeech:
// It may be nested, but we need the owner (index) of the list,
// no matter how high up.
int reversalIndexId = cache.GetOwnerOfObjectOfClass(hvoObj, ReversalIndex.kclsidReversalIndex);
if (reversalIndexId > 0)
ri = ReversalIndex.CreateFromDBObject(cache, reversalIndexId);
break;
case LexSense.kclsidLexSense:
// Pick a plausible default reversal index for the LexSense.
case LexDb.kclsidLexDb: // happens while initializing bulk edit combos
default: // since this doesn't actually depend on the hvo, it's not a bad general default.
List<int> rgriCurrent = cache.LangProject.LexDbOA.CurrentReversalIndices;
if (rgriCurrent.Count > 0)
{
ri = ReversalIndex.CreateFromDBObject(cache, (int)rgriCurrent[0]);
}
else
{
if (cache.LangProject.LexDbOA.ReversalIndexesOC.Count > 0)
{
int hvo = cache.LangProject.LexDbOA.ReversalIndexesOC.HvoArray[0];
ri = (IReversalIndex)CmObject.CreateFromDBObject(cache, hvo);
}
}
break;
}
if (ri != null)
return ri.WritingSystemRAHvo;
}
return wsDefault;
}
示例2: SetDlgInfoForComponentLexeme
/// <summary>
/// when calling the dialog from an "Insert Variant" context this
/// constructor is used to indicate that m_startingEntry is a componentLexeme
/// rather than the variant
/// </summary>
/// <param name="cache"></param>
/// <param name="mediator"></param>
/// <param name="componentLexeme">the entry we wish to find or create a variant for.</param>
protected void SetDlgInfoForComponentLexeme(FdoCache cache, Mediator mediator, IVariantComponentLexeme componentLexeme)
{
m_fBackRefToVariant = true;
ILexEntry startingEntry = null;
if (componentLexeme.ClassID == LexEntry.kclsidLexEntry)
{
startingEntry = componentLexeme as LexEntry;
}
else
{
int hvoEntry = cache.GetOwnerOfObjectOfClass(componentLexeme.Hvo, LexEntry.kclsidLexEntry);
if (hvoEntry != 0)
startingEntry = LexEntry.CreateFromDBObject(cache, hvoEntry);
}
base.SetDlgInfo(cache, mediator, startingEntry);
// we are looking for an existing variant form
// so hide the Entry/Sense radio group box.
grplbl.Visible = false;
// also hide variant type.
tcVariantTypes.Visible = false;
lblVariantType.Visible = false;
m_fGetVariantEntryTypeFromTreeCombo = false;
lblCreateEntry.Visible = false;
// The dialog title and other labels need to reflect "Insert Variant" context.
m_formLabel.Text = LexTextControls.ks_Variant;
this.Text = LexTextControls.ksFindVariant;
btnInsert.Text = LexTextControls.ks_Create;
// We disable the "Create" button when we don't have text in the Find textbox.
UpdateButtonCreateNew();
}
示例3: 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;
}
}