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


C# IVwStylesheet.GetContext方法代码示例

本文整理汇总了C#中IVwStylesheet.GetContext方法的典型用法代码示例。如果您正苦于以下问题:C# IVwStylesheet.GetContext方法的具体用法?C# IVwStylesheet.GetContext怎么用?C# IVwStylesheet.GetContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IVwStylesheet的用法示例。


在下文中一共展示了IVwStylesheet.GetContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetDefaultDomainForStyle

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Get the default marker domain for the given style name
		/// </summary>
		/// <param name="styleSheet">style sheet to use for determining the domain</param>
		/// <param name="styleName">The style name</param>
		/// <returns>the default marker domain</returns>
		/// ------------------------------------------------------------------------------------
		public static MarkerDomain GetDefaultDomainForStyle(IVwStylesheet styleSheet,
			string styleName)
		{
			try
			{
				// Footnote target ref and marker styles are always footnote domain
				if (styleName == ScrStyleNames.FootnoteTargetRef ||
					styleName == ScrStyleNames.FootnoteMarker)
					return MarkerDomain.Footnote;

				// Chapter and verse numbers are always Default domain
				if (styleName == ScrStyleNames.ChapterNumber ||
					styleName == ScrStyleNames.VerseNumber)
					return MarkerDomain.Default;

				if (styleSheet == null)
				{
					// REVIEW: JohnW - Seems like this should not be valid since we won't get
					//         the mapping right. Tried putting a Debug.Fail here to see if
					//         I could eliminate this check, but tests will have to be
					//         changed and the code to update existing settings will need
					//         to be changed.
					return MarkerDomain.Default;
				}

				// Base the domain on the style context
				switch ((ContextValues)styleSheet.GetContext(styleName))
				{
					case ContextValues.Note:
						return MarkerDomain.Footnote;
					case ContextValues.Annotation:
						return MarkerDomain.Note;
					default:
						return MarkerDomain.Default;
				}
			}
			catch
			{
				// This is probably in a test, so we don't care. (Or maybe something really
				// bad happened, like the style was deleted or renamed.)
				return MarkerDomain.Default;
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:51,代码来源:ScrMarkerMapping.cs


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