本文整理汇总了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);
}
示例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();
}
}
示例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);
}
}