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


C# INameScope类代码示例

本文整理汇总了C#中INameScope的典型用法代码示例。如果您正苦于以下问题:C# INameScope类的具体用法?C# INameScope怎么用?C# INameScope使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: AddScopeElements

 private void AddScopeElements(INameScope scope, ElementAccessor[] elements, ref bool duplicateElements, bool allowDuplicates)
 {
     for (int i = 0; i < elements.Length; i++)
     {
         this.AddScopeElement(scope, elements[i], ref duplicateElements, allowDuplicates);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:XmlSchemaImporter.cs

示例2: Remove

 public void Remove(FrameworkElement target, INameScope nameScope, object layerOwner)
 {
     if (Storyboard != null)
     {
         Storyboard.Remove(target, nameScope, layerOwner);
     }
 }
开发者ID:diab0l,项目名称:Granular,代码行数:7,代码来源:StoryboardAction.cs

示例3: Timer

 public Timer(
     NodeGCType gcType,
     INodeScope parentNodeScope,
     INameScope parentNameScope,
     string initialBasicName
 )
     : base(gcType, parentNodeScope, parentNameScope, initialBasicName)
 {
     Debug.Assert(gcType == s_gcTypeOfAllInstances);
 }
开发者ID:cerver,项目名称:GC_Timer-3,代码行数:10,代码来源:GCN_Timer.cs

示例4: InitializeContext

        public InitializeContext(object target, InitializeContext parentContext, INameScope nameScope, FrameworkElement templatedParent, BaseValueSource valueSource)
        {
            this.Target = target;
            this.ParentContext = parentContext;

            this.NameScope = nameScope;
            this.TemplatedParent = templatedParent;
            this.ValueSource = valueSource;

            this.Root = parentContext != null && parentContext.Root != null ? parentContext.Root : Target;
        }
开发者ID:highzion,项目名称:Granular,代码行数:11,代码来源:InitializeContext.cs

示例5: AddUniqueAccessor

 private static void AddUniqueAccessor(INameScope scope, Accessor accessor)
 {
     Accessor accessor2 = (Accessor) scope[accessor.Name, accessor.Namespace];
     if (accessor2 != null)
     {
         if (accessor is ElementAccessor)
         {
             throw new InvalidOperationException(Res.GetString("XmlDuplicateElementName", new object[] { accessor2.Name, accessor2.Namespace }));
         }
         throw new InvalidOperationException(Res.GetString("XmlDuplicateAttributeName", new object[] { accessor2.Name, accessor2.Namespace }));
     }
     scope[accessor.Name, accessor.Namespace] = accessor;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:XmlReflectionImporter.cs

示例6: Begin

        public void Begin(FrameworkElement containingObject, INameScope nameScope = null, HandoffBehavior handoffBehavior = HandoffBehavior.SnapshotAndReplace, object layerOwner = null)
        {
            Stop(containingObject);

            TimelineClock clock = CreateClock();
            clock.Begin(((IAnimatable)containingObject).RootClock);

            clocks[containingObject] = clock;

            ListDictionary<TargetKey, AnimationTimelineClock> targets = GetAnimationClocksTargets(clock, containingObject, nameScope ?? NameScope.GetContainingNameScope(containingObject));
            foreach (TargetKey target in targets.GetKeys())
            {
                target.Target.ApplyAnimationClocks(target.TargetProperty, targets.GetValues(target), handoffBehavior, layerOwner);
            }
        }
开发者ID:highzion,项目名称:Granular,代码行数:15,代码来源:Storyboard.cs

示例7: AddScopeElement

 private void AddScopeElement(INameScope scope, ElementAccessor element, ref bool duplicateElements, bool allowDuplicates)
 {
     if (scope != null)
     {
         ElementAccessor accessor = (ElementAccessor) scope[element.Name, element.Namespace];
         if (accessor != null)
         {
             if (!allowDuplicates)
             {
                 throw new InvalidOperationException(Res.GetString("XmlDuplicateElementInScope", new object[] { element.Name, element.Namespace }));
             }
             if (accessor.Mapping.TypeDesc != element.Mapping.TypeDesc)
             {
                 throw new InvalidOperationException(Res.GetString("XmlDuplicateElementInScope1", new object[] { element.Name, element.Namespace }));
             }
             duplicateElements = true;
         }
         else
         {
             scope[element.Name, element.Namespace] = element;
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:23,代码来源:XmlSchemaImporter.cs

示例8: WireRootObjectToParent

        private static DependencyObject WireRootObjectToParent(object createdObject, DependencyObject rootObject, DependencyObject container, FrameworkElement feContainer, INameScope nameScope)
        {
            rootObject = createdObject as DependencyObject;
            if (rootObject != null)
            {
                // Add the root to the appropriate tree.
                if (feContainer != null)
                {
                    // Put the root object into FE.Templatechild (must be a UIElement).
                    UIElement rootElement = rootObject as UIElement;
                    if (rootElement == null)
                    {
                        throw new InvalidOperationException(SR.Get(SRID.TemplateMustBeFE, new object[] { rootObject.GetType().FullName }));
                    }
                    feContainer.TemplateChild = rootElement;

                    Debug.Assert(!(rootElement is FrameworkElement) ||
                        ((FrameworkElement)rootElement).TemplateChildIndex != -1);
                }
                // If we have a container that is not a FE, add to the logical tree of the FEF
                else if (container != null)
                {
                    FrameworkElement feResult;
                    FrameworkContentElement fceResult;
                    Helper.DowncastToFEorFCE(rootObject, out feResult, out fceResult, true);
                    FrameworkElementFactory.AddNodeToLogicalTree((FrameworkContentElement)container,
                        rootObject.GetType(), feResult != null, feResult, fceResult);
                }


                // Set the TemplateNameScope on the root
                if (NameScope.GetNameScope(rootObject) == null)
                {
                    NameScope.SetNameScope(rootObject, nameScope);
                }
            }
            return rootObject;
        }
开发者ID:mind0n,项目名称:hive,代码行数:38,代码来源:FrameworkTemplate.cs

示例9: HandleBeforeProperties

        private void HandleBeforeProperties(object createdObject,
            ref DependencyObject rootObject,
            DependencyObject container,
            FrameworkElement feContainer,
            INameScope nameScope)
        {
            if (createdObject is FrameworkElement || createdObject is FrameworkContentElement)
            {
                // We want to set TemplateChild on the parent if we are dealing with the root
                // We MUST wait until the object is wired into the Template vis TemplateNameScope.RegisterName
                if (rootObject == null)
                {
                    rootObject = WireRootObjectToParent(createdObject, rootObject, container, feContainer, nameScope);
                }

                InvalidatePropertiesOnTemplate(container, createdObject);
            }
        }
开发者ID:mind0n,项目名称:hive,代码行数:18,代码来源:FrameworkTemplate.cs

示例10: SetNameScope

 /// <summary>
 /// Sets the value of the attached <see cref="NameScopeProperty"/> on a visual.
 /// </summary>
 /// <param name="visual">The visual.</param>
 /// <param name="value">The value to set.</param>
 public static void SetNameScope(Visual visual, INameScope value)
 {
     visual.SetValue(NameScopeProperty, value);
 }
开发者ID:furesoft,项目名称:Perspex,代码行数:9,代码来源:NameScope.cs

示例11: NameScope

		public NameScope (INameScope external)
		{
			this.external = external;
		}
开发者ID:bbqchickenrobot,项目名称:WPFLight,代码行数:4,代码来源:NameScope.cs

示例12: FindNameScope

    /// <summary>
    /// Returns the nearest element implementing <see cref="INameScope"/>, stepping up the
    /// logical tree from our context object.
    /// </summary>
    /// <param name="result">Returns the nearest name scope element, if there is one.</param>
    /// <returns><c>true</c>, if a name scope could be found, <c>false</c> if it could not
    /// be found (yet).</returns>
    protected bool FindNameScope(out INameScope result)
    {
      result = null;
      DependencyObject current = _contextObject;
      if (current == null)
      {
#if DEBUG_BINDINGS
        DebugOutput("FindNameScope doesn't have a current context");
#endif
        return false;
      }
      while (current != null)
      {
        if (current is INameScope)
        {
          result = current as INameScope;
          return true;
        }
        if (current is UIElement)
        {
          UIElement uiElement = (UIElement) current;
          AbstractProperty templateNameScopeProperty = uiElement.TemplateNameScopeProperty;
          AttachToSourcePathProperty(templateNameScopeProperty);
          if ((result = ((INameScope) templateNameScopeProperty.GetValue())) != null)
            return true;
        }
        if (!FindParent(current, out current, FindParentMode.HybridPreferLogicalTree))
          return false;
      }
      return false;
    }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:38,代码来源:BindingMarkupExtension.cs

示例13: ResolveTargetName

    /// <summary>
    ///     Finds the target element of a Storyboard.TargetName property.
    /// </summary>
    /// <remarks>
    ///     This is using a different set of FindName rules than that used
    /// by ResolveBeginStoryboardName for finding a BeginStoryboard object due
    /// to the different FindName behavior in templated objects.
    ///
    ///     The templated object name is the name attached to the
    /// FrameworkElementFactory that created the object.  There are many of them
    /// created, one per templated object.  So we need to use Template.FindName()
    /// to find the templated child using the context of the templated parent.
    ///
    ///     Note that this FindName() function on the template class is
    /// completely different from the INameScope.FindName() function on the
    /// same class
    /// </remarks>
    internal static DependencyObject ResolveTargetName(
        string targetName,
        INameScope nameScope,
        DependencyObject element )
    {
        object           nameScopeUsed = null;
        object           namedObject = null;
        DependencyObject targetObject = null;
        FrameworkElement fe = element as FrameworkElement;
        FrameworkContentElement fce = element as FrameworkContentElement;

        if( fe != null )
        {
            if( nameScope != null )
            {
                namedObject = ((FrameworkTemplate)nameScope).FindName(targetName, fe);
                nameScopeUsed = nameScope;
            }
            else
            {
                namedObject = fe.FindName(targetName);
                nameScopeUsed = fe;
            }
        }
        else if( fce != null )
        {
            Debug.Assert( nameScope == null );
            namedObject = fce.FindName(targetName);
            nameScopeUsed = fce;
        }
        else
        {
            throw new InvalidOperationException(
                SR.Get(SRID.Storyboard_NoNameScope, targetName));
        }

        if( namedObject == null )
        {
            throw new InvalidOperationException(
                SR.Get(SRID.Storyboard_NameNotFound, targetName, nameScopeUsed.GetType().ToString()));
        }

        targetObject = namedObject as DependencyObject;
        if( targetObject == null )
        {
            throw new InvalidOperationException(SR.Get(SRID.Storyboard_TargetNameNotDependencyObject, targetName ));
        }

        return targetObject;
    }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:67,代码来源:Storyboard.cs

示例14: RegisterName

 private void RegisterName(ObjectWriterContext ctx, string name, object inst, XamlType xamlType, INameScope nameScope, INameScope parentNameScope, bool isRoot)
 {
     INameScope objA = nameScope;
     NameScopeDictionary dictionary = nameScope as NameScopeDictionary;
     if (dictionary != null)
     {
         objA = dictionary.UnderlyingNameScope;
     }
     if (object.ReferenceEquals(objA, inst) && !isRoot)
     {
         nameScope = parentNameScope;
     }
     if (!(inst is NameFixupToken))
     {
         try
         {
             nameScope.RegisterName(name, inst);
         }
         catch (Exception exception)
         {
             if (CriticalExceptions.IsCriticalException(exception))
             {
                 throw;
             }
             throw this.WithLineInfo(new XamlObjectWriterException(System.Xaml.SR.Get("NameScopeException", new object[] { exception.Message }), exception));
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:XamlObjectWriter.cs

示例15: AddUniqueAccessor

 static void AddUniqueAccessor(INameScope scope, Accessor accessor) {
     Accessor existing = (Accessor)scope[accessor.Name, accessor.Namespace];
     if (existing != null) {
         if (accessor is ElementAccessor) {
             throw new InvalidOperationException(Res.GetString(Res.XmlDuplicateElementName, existing.Name, existing.Namespace));
         }
         else {
             #if DEBUG
             if (!(accessor is AttributeAccessor))
                 throw new InvalidOperationException(Res.GetString(Res.XmlInternalErrorDetails, "Bad accessor type " + accessor.GetType().FullName));
             #endif
             throw new InvalidOperationException(Res.GetString(Res.XmlDuplicateAttributeName, existing.Name, existing.Namespace));
         }
     }
     else {
         scope[accessor.Name, accessor.Namespace] = accessor;
     }
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:18,代码来源:xmlreflectionimporter.cs


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