Ejemplo n.º 1
0
 /// <summary>Adds an enumeration of containable editor or container to existing editors and to a container.</summary>
 /// <param name="containables">The editables to add.</param>
 public void AddRange(IEnumerable <IUniquelyNamed> containables)
 {
     foreach (var containable in containables)
     {
         if (containable is IEditable)
         {
             Editables.AddOrReplace(containable as IEditable);
         }
         if (containable is IEditableContainer)
         {
             Containers.AddOrReplace(containable as IEditableContainer);
         }
         if (containable is EditorModifierAttribute)
         {
             EditableModifiers.Add(containable as EditorModifierAttribute);
         }
         if (containable is IDisplayable)
         {
             Displayables.AddOrReplace(containable as IDisplayable);
         }
         if (containable is IContentModifier)
         {
             ContentModifiers.Add(containable as IContentModifier);
         }
     }
     //ReloadRoot();
 }
Ejemplo n.º 2
0
        private void AddRangeInternal(IEnumerable <IUniquelyNamed> containables)
        {
            var list = new List <IUniquelyNamed>(containables);

            list.Sort((f, s) =>
            {
                if (f is IComparable <IUniquelyNamed> )
                {
                    return((f as IComparable <IUniquelyNamed>).CompareTo(s));
                }
                if (s is IComparable <IUniquelyNamed> )
                {
                    return(-(s as IComparable <IUniquelyNamed>).CompareTo(f));
                }
                return(0);
            });

            foreach (var containable in list)
            {
                if (containable is IEditable)
                {
                    Editables.AddOrReplace(containable as IEditable);
                }
                if (containable is IEditableContainer)
                {
                    Containers.AddOrReplace(containable as IEditableContainer);
                }
                if (containable is EditorModifierAttribute)
                {
                    EditableModifiers.Add(containable as EditorModifierAttribute);
                }
                if (containable is IDisplayable)
                {
                    Displayables.AddOrReplace(containable as IDisplayable);
                }
                if (containable is IContentTransformer)
                {
                    ContentTransformers.Add(containable as IContentTransformer);
                }

                NamedOperators.Add(containable);
            }
        }