本文整理汇总了C#中SIL.FieldWorks.FDO.FdoCache.MoveOwningSequence方法的典型用法代码示例。如果您正苦于以下问题:C# FdoCache.MoveOwningSequence方法的具体用法?C# FdoCache.MoveOwningSequence怎么用?C# FdoCache.MoveOwningSequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIL.FieldWorks.FDO.FdoCache
的用法示例。
在下文中一共展示了FdoCache.MoveOwningSequence方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RDEMergeSense
/// <summary>
/// This is called (by reflection) in an RDE view (DoMerges() method of XmlBrowseRDEView)
/// that is creating LexSenses (and entries) by having
/// the user enter a lexeme form and definition
/// for a collection of words in a given semantic domain.
/// On loss of focus, switch domain, etc., this method is called for each
/// newly created sense, to determine whether it can usefully be merged into some
/// pre-existing lex entry.
///
/// The idea is to do one of the following, in order of preference:
/// (a) If there are other LexEntries which have the same LF and a sense with the
/// same definition, add hvoDomain to the domains of those senses, and delete hvoSense.
/// (b) If there is a pre-existing LexEntry (not the owner of one of newHvos)
/// that has the same lexeme form, move hvoSense to that LexEntry.
/// (c) If there is another new LexEntry (the owner of one of newHvos other than hvoSense)
/// that has the same LF, we want to merge the two. In this case we expect to be called
/// in turn for all of these senses, so to simplify, the one with the smallest HVO
/// is kept and the others merged.
/// </summary>
/// <param name="hvoDomain"></param>
/// <param name="tagList"></param>
/// <param name="columns">List of XmlNode objects</param>
/// <param name="cache"></param>
/// <param name="hvoSense"></param>
/// <param name="newHvos">Set of new senses (including hvoSense).</param>
public static void RDEMergeSense(int hvoDomain, int tagList,
List<XmlNode> columns, FdoCache cache, int hvoSense, Set<int> newHvos)
{
// The goal is to find a lex entry with the same lexeme form.form as hvoSense's LexEntry.
ILexSense ls = LexSense.CreateFromDBObject(cache, hvoSense);
ILexEntry leTarget = LexEntry.CreateFromDBObject(cache, ls.EntryID);
string homographForm = leTarget.HomographForm;
string sDefnTarget = ls.Definition.AnalysisDefaultWritingSystem.Text;
// Check for pre-existing LexEntry which has the same homograph form
bool fGotExactMatch;
ILexEntry leSaved = FindBestLexEntryAmongstHomographs(cache, homographForm, sDefnTarget, leTarget, newHvos, hvoDomain, out fGotExactMatch);
if (fGotExactMatch)
{
// delete the entry AND sense
leTarget.DeleteUnderlyingObject();
DeleteSense(cache, hvoDomain, tagList, hvoSense);
}
else if (leSaved != null)
{
// move the one and only sense of leTarget to leSaved...provided it has a compatible MSA
// of the expected type.
ILexSense sense = leTarget.SensesOS.FirstItem as ILexSense;
if (sense.MorphoSyntaxAnalysisRA is MoStemMsa)
{
IMoMorphSynAnalysis newMsa = null;
foreach (IMoMorphSynAnalysis msa in leSaved.MorphoSyntaxAnalysesOC)
{
if (msa is IMoStemMsa)
newMsa = msa;
}
if (newMsa != null)
{
// Fix the MSA of the sense to point at one of the MSAs of the new owner.
sense.MorphoSyntaxAnalysisRA = newMsa;
// Move it to the new owner.
cache.MoveOwningSequence(leTarget.Hvo, (int)LexEntry.LexEntryTags.kflidSenses, 0, 0,
leSaved.Hvo, (int)LexEntry.LexEntryTags.kflidSenses, leSaved.SensesOS.Count);
// delete the entry.
leTarget.DeleteUnderlyingObject();
// But NOT the sense from the domain...it just moved to another entry.
//DeleteSense(cache, hvoDomain, tagList, hvoSense);
}
}
}
// else do nothing (no useful match, let the LE survive)
}