本文整理汇总了C#中ILexEntry类的典型用法代码示例。如果您正苦于以下问题:C# ILexEntry类的具体用法?C# ILexEntry怎么用?C# ILexEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ILexEntry类属于命名空间,在下文中一共展示了ILexEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetDlgInfo
/// <summary>
/// Set up the dlg in preparation to showing it.
/// </summary>
/// <param name="cache">FDO cache.</param>
/// <param name="mediator">Mediator used to restore saved siz and location info.</param>
/// <param name="startingEntry">Entry that cannot be used as a match in this dlg.</param>
public void SetDlgInfo(FdoCache cache, Mediator mediator, ILexEntry startingEntry)
{
CheckDisposed();
Debug.Assert(startingEntry != null);
m_startingEntry = startingEntry;
SetDlgInfo(cache, null, mediator);
// Relocate remaining three buttons.
Point pt = m_btnHelp.Location;
// Make the Help btn 20 off the right edge of the dlg
pt.X = Width - m_btnHelp.Width - 20;
m_btnHelp.Location = pt;
// Make the Cancel btn 10 from the left of the Help btn
pt.X -= (m_btnClose.Width + 10);
m_btnClose.Location = pt;
// Make the Merge Entry btn 10 from the left of the Cancel btn.
pt.X -= (m_btnOK.Width + 10);
m_btnOK.Location = pt;
SetBottomMessage();
SetHelpTopic("khtpMergeEntry");
//LT-3017 Launch the dialog with the Lexeme that is currently selected.
Form = m_startingEntry.HomographForm;
}
示例2: MakeSense
private ILexSense MakeSense(ILexEntry lme, string gloss)
{
var sense = Cache.ServiceLocator.GetInstance<ILexSenseFactory>().Create();
lme.SensesOS.Add(sense);
sense.Gloss.AnalysisDefaultWritingSystem = Cache.TsStrFactory.MakeString(gloss, Cache.DefaultAnalWs);
return sense;
}
示例3: ReportLexEntryCircularReference
/// <summary>
/// Report failure to make target a component of parent. If startedFromComplex is true, the user is looking
/// at parent, and tried to make target a component. Otherwise, the user is looking at target, and
/// tried to make parent a complex form.
/// </summary>
public static void ReportLexEntryCircularReference(ILexEntry parent, ICmObject target, bool startedFromComplex)
{
var itemString = target is ILexEntry ? FwCoreDlgs.ksEntry : FwCoreDlgs.ksSense;
var msgTemplate = startedFromComplex ? FwCoreDlgs.ksComponentIsComponent : FwCoreDlgs.ksComplexFormIsComponent;
var startedFrom = startedFromComplex ? parent.HeadWord.Text : target.ShortName;
var msg = String.Format(msgTemplate, itemString, startedFrom);
MessageBox.Show(Form.ActiveForm, msg, FwCoreDlgs.ksWhichIsComponent, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
示例4: MakeLexEntryRef
private ILexEntryRef MakeLexEntryRef(ILexEntry ownerEntry, int refType)
{
ILexEntryRef result = null;
result = Cache.ServiceLocator.GetInstance<ILexEntryRefFactory>().Create();
ownerEntry.EntryRefsOS.Add(result);
result.RefType = refType;
return result;
}
示例5: Create
/// <summary>
/// Create a new sense and add it to the given entry.
/// </summary>
/// <param name="entry"></param>
/// <param name="sandboxMSA"></param>
/// <param name="gloss"></param>
/// <returns></returns>
public ILexSense Create(ILexEntry entry, SandboxGenericMSA sandboxMSA, ITsString gloss)
{
var sense = new LexSense();
entry.SensesOS.Add(sense);
sense.SandboxMSA = sandboxMSA;
if (gloss != null)
{
sense.Gloss.set_String(gloss.get_WritingSystemAt(0), gloss);
}
return sense;
}
示例6: SetupForLexSenseFactoryCreate
private void SetupForLexSenseFactoryCreate(out int germanWsId, out ITsString tssGermanGloss,
out ILexEntry entry, out ILexSenseFactory lexSenseFactory, out SandboxGenericMSA msa)
{
germanWsId = Cache.WritingSystemFactory.GetWsFromStr("de");
Cache.LangProject.AnalysisWritingSystems.Add(
Cache.WritingSystemFactory.get_EngineOrNull(germanWsId) as IWritingSystem);
var lexFactory = Cache.ServiceLocator.GetInstance<ILexEntryFactory>();
tssGermanGloss = Cache.TsStrFactory.MakeString("da", germanWsId);
entry = lexFactory.Create();
lexSenseFactory = Cache.ServiceLocator.GetInstance<ILexSenseFactory>();
msa = new SandboxGenericMSA
{
MainPOS =
Cache.LangProject.PartsOfSpeechOA.PossibilitiesOS.Where(
pos => pos.Name.AnalysisDefaultWritingSystem.Text == "noun")
.Cast<IPartOfSpeech>()
.FirstOrDefault(),
MsaType = MsaType.kStem
};
}
示例7: PaLexEntry
/// ------------------------------------------------------------------------------------
internal PaLexEntry(ILexEntry lxEntry)
{
var svcloc = lxEntry.Cache.ServiceLocator;
DateCreated = lxEntry.DateCreated;
DateModified = lxEntry.DateModified;
//ExcludeAsHeadword = lxEntry.ExcludeAsHeadword; remove
ExcludeAsHeadword = false; // MDL: remove when IPaLexEntry is updated
// ShowMainEntryIn = lxEntry.ShowMainEntryIn.Select(x => new PaLexShowMainEntryIn(x)).ToList(); // MDL: uncomment when IPaLexEntry is updated
ImportResidue = lxEntry.ImportResidue.Text;
xPronunciations = lxEntry.PronunciationsOS.Select(x => new PaLexPronunciation(x)).ToList();
xSenses = lxEntry.SensesOS.Select(x => new PaLexSense(x)).ToList();
xComplexForms = lxEntry.ComplexFormEntries.Select(x => PaMultiString.Create(x.LexemeFormOA.Form, svcloc)).ToList();
xAllomorphs = lxEntry.AllAllomorphs.Select(x => PaMultiString.Create(x.Form, svcloc)).ToList();
xLexemeForm = PaMultiString.Create(lxEntry.LexemeFormOA.Form, svcloc);
xMorphType = PaCmPossibility.Create(lxEntry.PrimaryMorphType);
xCitationForm = PaMultiString.Create(lxEntry.CitationForm, svcloc);
xNote = PaMultiString.Create(lxEntry.Comment, svcloc);
xLiteralMeaning = PaMultiString.Create(lxEntry.LiteralMeaning, svcloc);
xBibliography = PaMultiString.Create(lxEntry.Bibliography, svcloc);
xRestrictions = PaMultiString.Create(lxEntry.Restrictions, svcloc);
xSummaryDefinition = PaMultiString.Create(lxEntry.SummaryDefinition, svcloc);
xVariantOfInfo = lxEntry.VariantEntryRefs.Select(x => new PaVariantOfInfo(x)).ToList();
xVariants = lxEntry.VariantFormEntryBackRefs.Select(x => new PaVariant(x)).ToList();
xGuid = lxEntry.Guid;
if (lxEntry.EtymologyOA != null)
xEtymology = PaMultiString.Create(lxEntry.EtymologyOA.Form, svcloc);
xComplexFormInfo = (from eref in lxEntry.EntryRefsOS
let pcfi = PaComplexFormInfo.Create(eref)
where pcfi != null
select pcfi).ToList();
}
示例8: GetLexReferenceName
private string GetLexReferenceName(ILexEntry lexEntry, ILexReference lexRef, out ILexEntry parentEntry)
{
parentEntry = null;
ILexRefType lexRefType = lexRef.OwnerOfClass<ILexRefType>();
string name = lexRefType.ShortName;
if (string.IsNullOrEmpty(name))
name = lexRefType.Abbreviation.BestAnalysisAlternative.Text;
var mappingType = (LexRefTypeTags.MappingTypes) lexRefType.MappingType;
switch (mappingType)
{
case LexRefTypeTags.MappingTypes.kmtSenseTree:
case LexRefTypeTags.MappingTypes.kmtEntryTree:
case LexRefTypeTags.MappingTypes.kmtEntryOrSenseTree:
case LexRefTypeTags.MappingTypes.kmtSenseAsymmetricPair: // Sense Pair with different Forward/Reverse names
case LexRefTypeTags.MappingTypes.kmtEntryAsymmetricPair: // Entry Pair with different Forward/Reverse names
case LexRefTypeTags.MappingTypes.kmtEntryOrSenseAsymmetricPair: // Entry or sense Pair with different Forward/Reverse names
if (lexRef.TargetsRS.Count > 0)
{
ICmObject firstObj = lexRef.TargetsRS[0];
ILexEntry firstEntry = null;
switch (firstObj.ClassID)
{
case LexEntryTags.kClassId:
firstEntry = (ILexEntry) firstObj;
break;
case LexSenseTags.kClassId:
firstEntry = firstObj.OwnerOfClass<ILexEntry>();
break;
}
if (firstEntry != lexEntry)
{
name = lexRefType.ReverseName.BestAnalysisAlternative.Text;
if (string.IsNullOrEmpty(name))
name = lexRefType.ReverseAbbreviation.BestAnalysisAlternative.Text;
}
if (mappingType == LexRefTypeTags.MappingTypes.kmtSenseTree
|| mappingType == LexRefTypeTags.MappingTypes.kmtEntryTree
|| mappingType == LexRefTypeTags.MappingTypes.kmtEntryOrSenseTree)
{
parentEntry = firstEntry;
}
}
break;
}
return name.Normalize();
}
示例9: GetValidMockSelection
private static MockSelection GetValidMockSelection(ILexEntry entry)
{
var sel = new MockSelection();
sel.TypeToReturn = VwSelType.kstText;
sel.EndHvo = sel.AnchorHvo = entry.Hvo;
sel.EndTag = sel.AnchorTag = LexEntryTags.kflidRestrictions; // arbitrary in this case
sel.EndIch = 2;
sel.AnchorIch = 5;
return sel;
}
示例10: SetDlgInfo
/// <summary>
/// Set up the dlg in preparation to showing it.
/// </summary>
/// <param name="cache">FDO cache.</param>
/// <param name="mediator"></param>
/// <param name="entry">LexEntry</param>
public void SetDlgInfo(FdoCache cache, Mediator mediator, ILexEntry entry)
{
CheckDisposed();
Debug.Assert(cache != null);
m_mediator = mediator;
m_cache = cache;
m_entry = entry;
m_tsf = m_cache.TsStrFactory;
m_fwTextBoxBottomMsg.WritingSystemFactory = m_cache.WritingSystemFactory;
//m_fwTextBoxBottomMsg.WritingSystemCode = 1; // What!? Why? No longer makes ANY sense!
IVwStylesheet stylesheet = FontHeightAdjuster.StyleSheetFromMediator(mediator);
// We want to do this BEFORE the text gets set, to avoid overriding its height properties.
// However, because of putting multiple lines in the box, we also need to do it AFTER we set the text
// (in SetBottomMessage) so it adjusts to the resulting even greater height.
m_fwTextBoxBottomMsg.AdjustForStyleSheet(this, null, stylesheet);
Font f = FontHeightAdjuster.GetFontForNormalStyle(
m_cache.ServiceLocator.WritingSystems.DefaultVernacularWritingSystem.Handle, stylesheet, m_cache.LanguageWritingSystemFactoryAccessor);
foreach (IMoForm allo in entry.AlternateFormsOS)
{
ListViewItem lvi = m_lvAlloOptions.Items.Add(allo.Form.VernacularDefaultWritingSystem.Text);
lvi.Tag = allo;
lvi.UseItemStyleForSubItems = true;
lvi.Font = f;
}
m_lvAlloOptions.Font = f;
// Get location to the stored values, if any.
object locWnd = m_mediator.PropertyTable.GetValue("swapDlgLocation");
// And when I do this, it works the first time, but later times the window is
// too small and doesn't show all the controls. Give up on smart location for now.
//object szWnd = this.Size;
object szWnd = null; // suppresses the smart location stuff.
//if (locWnd != null && szWnd != null)
//{
// Rectangle rect = new Rectangle((Point)locWnd, (Size)szWnd);
// ScreenUtils.EnsureVisibleRect(ref rect);
// DesktopBounds = rect;
// StartPosition = FormStartPosition.Manual;
//}
m_lvAlloOptions.Items[0].Selected = true;
Text = LexEdStrings.ksSwapLexWithAllo;
label2.Text = LexEdStrings.ksAlternateForms;
// Determine the help file to use, if any
m_helpTopic = "khtpSwapLexemeWithAllomorph";
if(m_mediator.HelpTopicProvider != null)
{
helpProvider = new HelpProvider();
helpProvider.HelpNamespace = m_mediator.HelpTopicProvider.HelpFile;
helpProvider.SetHelpKeyword(this, m_mediator.HelpTopicProvider.GetHelpString(m_helpTopic));
helpProvider.SetHelpNavigator(this, HelpNavigator.Topic);
}
}
示例11: CreateNewForm
IMoForm CreateNewForm(ILexEntry parent, int clsid)
{
switch (clsid)
{
case MoAffixProcessTags.kClassId:
return parent.Services.GetInstance<IMoAffixProcessFactory>().Create();
case MoAffixAllomorphTags.kClassId:
return parent.Services.GetInstance<IMoAffixAllomorphFactory>().Create();
case MoStemAllomorphTags.kClassId:
return parent.Services.GetInstance<IMoStemAllomorphFactory>().Create();
}
return null;
}
示例12: SwapAllomorphWithLexeme
private void SwapAllomorphWithLexeme(ILexEntry entry, IMoForm allomorph, Command cmd)
{
UndoableUnitOfWorkHelper.Do(cmd.UndoText, cmd.RedoText, entry, () =>
{
entry.AlternateFormsOS.Insert(allomorph.IndexInOwner, entry.LexemeFormOA);
entry.LexemeFormOA = allomorph;
});
}
示例13: SwapAllomorphWithLexeme
private void SwapAllomorphWithLexeme(ILexEntry entry, IMoForm allomorph, Command cmd)
{
using (UndoRedoCommandHelper undoRedoTask = new UndoRedoCommandHelper(m_dataEntryForm.Cache, cmd))
{
entry.AlternateFormsOS.InsertAt(entry.LexemeFormOA, allomorph.IndexInOwner);
entry.LexemeFormOA = allomorph;
}
}
示例14: GetLexReferenceName
private string GetLexReferenceName(ILexEntry lexEntry, ILexRefType lexRefType)
{
// The name we want to use for our lex reference is either the name or the reverse name
// (depending on the direction of the relationship, if relevant) of the owning lex ref type.
ITsString lexReferenceName = lexRefType.Name.BestVernacularAnalysisAlternative;
if (lexRefType.MappingType == (int)MappingTypes.kmtEntryAsymmetricPair ||
lexRefType.MappingType == (int)MappingTypes.kmtEntryOrSenseAsymmetricPair ||
lexRefType.MappingType == (int)MappingTypes.kmtSenseAsymmetricPair ||
lexRefType.MappingType == (int)MappingTypes.kmtEntryTree ||
lexRefType.MappingType == (int)MappingTypes.kmtEntryOrSenseTree ||
lexRefType.MappingType == (int)MappingTypes.kmtSenseTree)
{
if (lexEntry.OwnOrd == 0 && lexRefType.Name != null) // the original code had a check for name length as well.
lexReferenceName = lexRefType.ReverseName.BestAnalysisAlternative;
}
return lexReferenceName.Text;
}
示例15: CreateEntryFromDbEntry
/// ------------------------------------------------------------------------------------
/// <summary>
/// Creates a new LexicalEntry from the specified lexical entry in the DB
/// </summary>
/// ------------------------------------------------------------------------------------
private LexicalEntry CreateEntryFromDbEntry(LexemeType type, ILexEntry dbEntry)
{
if (type == LexemeType.Word)
throw new ArgumentException("Lexeme type specified can not be created from a LexEntry");
// A homograph number of zero in the DB means there is only one entry for the wordform.
// However, the interface requires there be an entry with a homograph of one even if
// there is only one entry.
LexicalEntry entry = new LexicalEntry(type, dbEntry.HomographForm,
dbEntry.HomographNumber > 0 ? dbEntry.HomographNumber : 1);
// Add the senses to the interface (non-DB) entry
foreach (ILexSense dbSense in dbEntry.SensesOS)
{
LexSense sense = new LexSense(dbSense.Guid.ToString());
AddDbGlossesToSense(sense, dbSense.Gloss);
entry.Senses.Add(sense); // Add the sense to the list of senses
}
return entry;
}