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


C# IContentType.IsOfAnyType方法代码示例

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


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

示例1: Create

		public ITextClassifierAggregator Create(IContentType contentType) {
			if (contentType == null)
				throw new ArgumentNullException(nameof(contentType));
			var list = new List<ITextClassifier>();
			foreach (var lz in textClassifierProviders) {
				if (!contentType.IsOfAnyType(lz.Metadata.ContentTypes))
					continue;
				var classifier = lz.Value.Create(contentType);
				if (classifier != null)
					list.Add(classifier);
			}
			return new TextClassifierAggregator(classificationTypeRegistryService, list);
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:13,代码来源:TextClassifierAggregatorService.cs

示例2: InitializeGlyphFactories

		void InitializeGlyphFactories(IContentType beforeContentType, IContentType afterContentType) {
			var oldFactories = new Dictionary<IGlyphFactoryProvider, IGlyphFactory>();
			foreach (var info in glyphFactories.Values)
				oldFactories[info.FactoryProvider] = info.Factory;
			glyphFactories.Clear();

			bool newFactory = false;
			int order = 0;
			foreach (var lazy in lazyGlyphFactoryProviders) {
				if (!afterContentType.IsOfAnyType(lazy.Metadata.ContentTypes))
					continue;
				IGlyphFactory glyphFactory = null;
				foreach (var type in lazy.Metadata.TagTypes) {
					Debug.Assert(type != null);
					if (type == null)
						break;
					Debug.Assert(!glyphFactories.ContainsKey(type));
					if (glyphFactories.ContainsKey(type))
						continue;
					Debug.Assert(typeof(IGlyphTag).IsAssignableFrom(type));
					if (!typeof(IGlyphTag).IsAssignableFrom(type))
						continue;

					if (glyphFactory == null) {
						if (oldFactories.TryGetValue(lazy.Value, out glyphFactory))
							oldFactories.Remove(lazy.Value);
						else {
							glyphFactory = lazy.Value.GetGlyphFactory(wpfTextViewHost.TextView, this);
							if (glyphFactory == null)
								break;
							newFactory = true;
						}
					}

					glyphFactories.Add(type, new GlyphFactoryInfo(order++, glyphFactory, lazy.Value));
				}
			}

			foreach (var factory in oldFactories.Values)
				(factory as IDisposable)?.Dispose();
			if (newFactory || oldFactories.Count != 0) {
				childCanvases = glyphFactories.Values.OrderBy(a => a.Order).Select(a => a.Canvas).ToArray();
				iconCanvas.Children.Clear();
				foreach (var c in childCanvases)
					iconCanvas.Children.Add(c);

				if (beforeContentType != null)
					RefreshEverything();
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:50,代码来源:GlyphMargin.cs

示例3: NotifyTextViewCreated

		void NotifyTextViewCreated(IContentType newContentType, IContentType oldContentType) {
			foreach (var lz in wpfTextViewCreationListeners) {
				if (oldContentType != null && oldContentType.IsOfAnyType(lz.Metadata.ContentTypes))
					continue;
				if (!TextDataModel.ContentType.IsOfAnyType(lz.Metadata.ContentTypes))
					continue;
				lz.Value.TextViewCreated(this);
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:9,代码来源:WpfTextView.cs


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