本文整理汇总了C#中ILexEntry.FindMatchingAllomorph方法的典型用法代码示例。如果您正苦于以下问题:C# ILexEntry.FindMatchingAllomorph方法的具体用法?C# ILexEntry.FindMatchingAllomorph怎么用?C# ILexEntry.FindMatchingAllomorph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ILexEntry
的用法示例。
在下文中一共展示了ILexEntry.FindMatchingAllomorph方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNewEntry
internal void CreateNewEntry(bool fCreateNow, out ILexEntry le, out IMoForm allomorph, out ILexSense sense)
{
CheckDisposed();
int hvoMorph = m_caches.DataAccess.get_ObjectProp(m_hvoMorph, ktagSbMorphForm);
ITsString tssForm = m_caches.DataAccess.get_MultiStringAlt(hvoMorph,
ktagSbNamedObjName, m_sandbox.RawWordformWs);
ITsString tssFullForm = m_sandbox.GetFullMorphForm(m_hvoMorph);
string form = StrFromTss(tssForm);
string fullForm = StrFromTss(tssFullForm);
le = null;
allomorph = null;
sense = null;
int entryID = 0;
int hvoSense = 0;
FdoCache cache = m_caches.MainCache;
// If we don't have a form or it isn't in a current vernacular writing system, give up.
if (tssForm == null || tssForm.Length == 0 ||
!LangProject.GetAllWritingSystems("all vernacular", m_caches.MainCache, null, 0, 0).Contains(StringUtils.GetWsOfRun(tssForm,0)))
{
return;
}
ITsString tssHeadWord = null;
using (InsertEntryDlg dlg = InsertEntryNow.CreateInsertEntryDlg(fCreateNow))
{
SetupDlgToCreateEntry(dlg, tssFullForm, cache);
dlg.ChangeUseSimilarToCreateAllomorph();
bool fCreatedEntry = false;
bool fCreateAllomorph = false;
if (fCreateNow)
{
// just create a new entry based on the given information.
dlg.CreateNewEntry();
}
else
{
// bring up the dialog so the user can make further decisions.
Form mainWnd = m_sandbox.FindForm();
// Making the form active fixes LT-2344 & LT-2345.
// I'm (RandyR) not sure what adverse impact might show up by doing this.
mainWnd.Activate();
dlg.SetHelpTopic("khtpInsertEntryFromInterlinear");
if (dlg.ShowDialog(mainWnd) == DialogResult.OK)
fCreateAllomorph = true;
}
dlg.GetDialogInfo(out entryID, out fCreatedEntry);
if (!fCreatedEntry && !fCreateAllomorph)
return;
// Get the appropriate MoForm?
FdoCache mainCache = m_caches.MainCache;
le = LexEntry.CreateFromDBObject(mainCache, entryID);
hvoSense = dlg.NewSenseId;
if (hvoSense > 0)
sense = new LexSense(mainCache, hvoSense);
else if (fCreateAllomorph && le.SensesOS.Count > 0)
sense = le.SensesOS.FirstItem;
allomorph = le.FindMatchingAllomorph(tssForm);
if (allomorph == null)
{
try
{
allomorph = MoForm.MakeMorph(mainCache, le, tssFullForm);
}
catch
{
// Try it without any reserved markers.
allomorph = MoForm.MakeMorph(mainCache, le,
StringUtils.MakeTss(MoForm.EnsureNoMarkers(fullForm, mainCache),
m_sandbox.RawWordformWs));
}
}
tssHeadWord = le.HeadWord;
if (allomorph != null)
UpdateMorphEntry(allomorph.Hvo, entryID, hvoSense);
}
}