当前位置: 首页>>代码示例>>C#>>正文


C# FdoCache.GetOwnerOfObjectOfClass方法代码示例

本文整理汇总了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;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:54,代码来源:LangProject.cs

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

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


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