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


C# IParserContext.LookupNamespace方法代码示例

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


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

示例1: FinishInitialization

    public override void FinishInitialization(IParserContext context)
    {
      // if we have a type specified in the event name, we get the RoutedEvent here
      string localName;
      string namespaceUri;
      context.LookupNamespace(Event, out localName, out namespaceUri);
      var namespaceHandler = context.GetNamespaceHandler(namespaceUri);
      if (namespaceHandler != null)
      {
        int n = localName.IndexOf('.');
        if (n >= 0)
        {
          var sourceType = namespaceHandler.GetElementType(localName.Substring(0, n), true);
          var eventName = localName.Substring(n + 1);

          _routedEvent = EventManager.GetRoutedEventForOwner(sourceType, eventName, true);
        }
        // for events without explicit set type, the type and RoutedEvent is looked up in Set/Reset on the target object type.
      }
      base.FinishInitialization(context);
    }
开发者ID:davinx,项目名称:MediaPortal-2,代码行数:21,代码来源:EventSetter.cs

示例2: ParseType

 /// <summary>
 /// Given a string specifying a type, this method returns the type.
 /// </summary>
 /// <param name="context">The current document context.</param>
 /// <param name="typeName">Type string in the form <c>sys:Int32</c>, where the prefix
 /// is a prefix currently registered in the <paramref name="context"/>, and the suffix
 /// is a type known by the namespace handler specified by the prefix.</param>
 /// <returns>Type object for the specified type string.</returns>
 public static Type ParseType(IParserContext context, string typeName)
 {
   string localName;
   string namespaceURI;
   context.LookupNamespace(typeName, out localName, out namespaceURI);
   return context.GetNamespaceHandler(namespaceURI).GetElementType(localName);
 }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:15,代码来源:ParserHelper.cs

示例3: ValueDataDescriptor

 void IEvaluableMarkupExtension.Initialize(IParserContext context)
 {
   string localName;
   string namespaceURI;
   context.LookupNamespace(_typeName, out localName, out namespaceURI);
   Type type = context.GetNamespaceHandler(namespaceURI).GetElementType(localName);
   IDataDescriptor result;
   try
   {
     if (PathExpression.Compile(context, _staticMemberName).Evaluate(
         new ValueDataDescriptor(type), out result))
       _value = result.Value;
   }
   catch (XamlBindingException e)
   {
     ServiceRegistration.Get<ILogger>().Warn("Error evaluating Static markup", e);
   }
 }
开发者ID:chekiI,项目名称:MediaPortal-2,代码行数:18,代码来源:StaticMarkupExtension.cs


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