• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ILexEntry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ILexEntry的典型用法代码示例。如果您正苦于以下问题:C# ILexEntry类的具体用法?C# ILexEntry怎么用?C# ILexEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ILexEntry类属于命名空间,在下文中一共展示了ILexEntry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:33,代码来源:MergeEntryDlg.cs


示例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;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:7,代码来源:ConfigureHomographTests.cs


示例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);
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:13,代码来源:MessageBoxes.cs


示例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;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:8,代码来源:CircularReferenceTests.cs


示例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;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:19,代码来源:FdoFactoryAdditions.cs


示例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
			};
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:20,代码来源:FdoFactoryAdditionsTests.cs


示例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();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:38,代码来源:PaLexEntry.cs


示例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();
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:48,代码来源:FdoLexEntryLexeme.cs


示例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;
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:10,代码来源:MacroListenerTests.cs


示例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);
			}
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:61,代码来源:SwapLexemeWithAllomorphDlg.cs


示例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;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:15,代码来源:LexEntryMenuHandler.cs


示例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;
			});
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:8,代码来源:LexEntryMenuHandler.cs


示例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;
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:8,代码来源:LexEntryMenuHandler.cs


示例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;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:19,代码来源:FdoLexEntryLexeme.cs


示例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;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:25,代码来源:LexicalProviderImpl.cs


示例16: SwapFormValues

		// Swap values of various attributes between an existing form that is a LexemeForm and
		// a newly created one. Includes adding the new one to the alternate forms of the entry, and
		// the id of the old one to a map of things to delete.
		private void SwapFormValues(ILexEntry entry, IMoForm origForm, IMoForm newForm, int typeHvo, Set<int> idsToDel)
		{
			entry.AlternateFormsOS.Add(newForm);
			origForm.SwapReferences(newForm);
			var muaOrigForm = origForm.Form;
			var muaNewForm = newForm.Form;
			muaNewForm.MergeAlternatives(muaOrigForm);
			newForm.MorphTypeRA = m_cache.ServiceLocator.GetInstance<IMoMorphTypeRepository>().GetObject(typeHvo);
			idsToDel.Add(origForm.Hvo);
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:13,代码来源:BulkEditBar.cs


示例17: CreateSense

		/// <summary>
		/// Create a new sense and add it to the given entry.
		/// </summary>
		/// <param name="entry"></param>
		/// <param name="dummyMSA"></param>
		/// <param name="gloss"></param>
		/// <returns></returns>
		public static ILexSense CreateSense(ILexEntry entry, DummyGenericMSA dummyMSA, string gloss)
		{
			ILexSense sense = (ILexSense)entry.SensesOS.Append(new LexSense());
			(sense as LexSense).DummyMSA = dummyMSA;

			// Handle gloss.
			if (gloss != null && gloss.Length > 0)
			{
				if (gloss.Length > 256)
				{
					System.Windows.Forms.MessageBox.Show(Strings.ksTruncatingGloss, Strings.ksWarning,
						System.Windows.Forms.MessageBoxButtons.OK,
						System.Windows.Forms.MessageBoxIcon.Warning);
					gloss = gloss.Substring(0, 256);
				}
				sense.Gloss.AnalysisDefaultWritingSystem = gloss;
			}

			return sense;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:27,代码来源:LingOverrides.cs


示例18: SetLexeme

		private void SetLexeme(ILexEntry le, string form)
		{
			UndoableUnitOfWorkHelper.Do("Undo stuff", "Redo stuff", m_actionHandler,
				() =>
					{
						var lf = le.Services.GetInstance<IMoStemAllomorphFactory>().Create();
						le.LexemeFormOA = lf;
						lf.Form.VernacularDefaultWritingSystem = lf.Cache.TsStrFactory.MakeString(form,
							Cache.DefaultVernWs);
					});
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:11,代码来源:PropChangedTests.cs


示例19: GetVariantAndComponentAndSelectedEntryType

		/// <summary>
		/// extracts the variant and component from the dialog, depending upon whether we're
		/// called from an "Insert Variant" or "Variant Of..." context.
		/// </summary>
		/// <param name="variant"></param>
		/// <param name="componentLexeme"></param>
		private void GetVariantAndComponentAndSelectedEntryType(out ILexEntry variant, out IVariantComponentLexeme componentLexeme, out ILexEntryType selectedEntryType)
		{
			variant = null;
			componentLexeme = null;
			if (m_fBackRefToVariant)
			{
				// in "Insert Variant" contexts,
				// we're calling the dialog from the component lexeme, so consider SelectedID as the variant.
				componentLexeme = m_startingEntry;
				variant = LexEntry.CreateFromDBObject(m_cache, SelectedID);
			}
			else
			{
				// in "Variant of..." contexts,
				// we're calling the dialog from the variant, so consider SelectedID the componentLexeme.
				variant = m_startingEntry;
				componentLexeme = CmObject.CreateFromDBObject(m_cache, SelectedID) as IVariantComponentLexeme;
			}
			if (m_fGetVariantEntryTypeFromTreeCombo)
				selectedEntryType = LexEntryType.CreateFromDBObject(m_cache, SelectedVariantEntryTypeHvo);
			else
				selectedEntryType = null;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:29,代码来源:LinkVariantToEntryOrSense.cs


示例20: FindBestLexEntryAmongstHomographs

		/// <summary>
		/// find the best existing LexEntry option matching 'homographform' (and possibly 'sDefnTarget')
		/// in order to determine if we should merge leTarget into that entry.
		/// </summary>
		/// <param name="cache"></param>
		/// <param name="homographForm"></param>
		/// <param name="sDefnTarget"></param>
		/// <param name="leTarget">a LexEntry that you want to consider merging into a more appropriate LexEntry,
		/// if null, we ignore 'newHvos' and 'hvoDomain'</param>
		/// <param name="newHvos"></param>
		/// <param name="hvoDomain"></param>
		/// <param name="fGotExactMatch"></param>
		/// <returns></returns>
		private static ILexEntry FindBestLexEntryAmongstHomographs(FdoCache cache,
			string homographForm, string sDefnTarget, ILexEntry leTarget, Set<int> newHvos,
			int hvoDomain, out bool fGotExactMatch)
		{
			ILexEntry leSaved = null;
			List<ILexEntry> rgEntries = LexEntry.CollectHomographs(homographForm, 0,
				LexEntry.GetHomographList(cache, homographForm),
				MoMorphType.kmtStem, true);
			leSaved = null; // saved entry to merge into (from previous iteration)
			bool fSavedIsOld = false; // true if leSaved is old (and non-null).
			fGotExactMatch = false; // true if we find a match for cf AND defn.
			bool fCurrentIsNew = false;
			foreach (ILexEntry leCurrent in rgEntries)
			{
				if (leTarget != null)
				{
					if (leCurrent.Hvo == leTarget.Hvo)
						continue; // not interested in merging with ourself.
					// See if this is one of the newly added entries. If it is, it has exactly one sense,
					// and that sense is in our list.
					fCurrentIsNew = leCurrent.SensesOS.Count == 1 && newHvos.Contains(leCurrent.SensesOS.HvoArray[0]);
					if (fCurrentIsNew && leCurrent.Hvo > leTarget.Hvo)
						continue;  // won't consider ANY kind of merge with a new object of greater HVO.
				}
				// Decide whether lexE should be noted as the entry that we will merge with if
				// we don't find an exact match.
				if (!fGotExactMatch) // leMerge is irrelevant if we already got an exact match.
				{
					if (leSaved == null)
					{
						leSaved = leCurrent;
						fSavedIsOld = !fCurrentIsNew;
					}
					else // we have already found a candidate
					{
						if (fSavedIsOld)
						{
							// We will only consider the new one if it is also old, and
							// (rather arbitrarily) if it has a smaller HVO
							if ((!fCurrentIsNew) && leCurrent.Hvo < leSaved.Hvo)
							{
								leSaved = leCurrent; // fSavedIsOld stays true.
							}
						}
						else // we already have a candidate, but it is another of the new entries
						{
							// if current is old, we'll use it for sure
							if (!fCurrentIsNew)
							{
								leSaved = leCurrent;
								fSavedIsOld = false; // since fCurrentIsNew is false.
							}
							else
							{
								// we already have a new candidate (which must have a smaller hvo than target)
								// and now we have another new entry which matches!
								// We'll prefer it only if its hvo is smaller still.
								if (leCurrent.Hvo < leSaved.Hvo)
								{
									leSaved = leCurrent; // fSavedIsOld stays false.
								}
							}
						}
					}
				}

				// see if we want to try to find a matching existing sense.
				if (sDefnTarget == null)
					continue;
				// This deals with all senses in the entry,
				// whether owned directly by the entry or by its senses
				// at whatever level.
				// If the new definition matches an existing defintion (or if both
				// are missing) add the current domain to the existing sense.
				// Note: if more than one sense has the same definition (maybe missing) we should
				// add the domain to all senses--not just the first one encountered.
				foreach (ILexSense lexS in leCurrent.AllSenses)
				{
					if (lexS.Definition != null
						&& lexS.Definition.AnalysisDefaultWritingSystem != null)
					{
						string sDefnCurrent = lexS.Definition.AnalysisDefaultWritingSystem.UnderlyingTsString.Text;
						if ((sDefnCurrent == null && sDefnTarget == null) ||
							(sDefnCurrent != null && sDefnTarget != null && sDefnCurrent.Trim() == sDefnTarget.Trim()))
						{
							// We found a sense that has the same citation form and definition as the one
							// we're trying to merge.
//.........这里部分代码省略.........
开发者ID:sillsdev,项目名称:WorldPad,代码行数:101,代码来源:LingOverrides.cs



注:本文中的ILexEntry类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ILexer类代码示例发布时间:2022-05-24
下一篇:
C# ILevelGeometry类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap