コード例 #1
0
 /// <summary>
 /// Removes all IAttachables contained in the argument attachableList from this and clears the two-way relationships between
 /// this and all IAttachables removed.
 /// </summary>
 /// <param name="attachableList">The list of IAttachables to remove.</param>
 #endregion
 public void Remove(AttachableList <T> attachableList)
 {
     for (int i = 0; i < attachableList.Count; i++)
     {
         Remove(attachableList[i]);
     }
 }
コード例 #2
0
 /// <summary>
 /// Adds all IAttachables contained in the argument AttachableList to this AttachableList and creates two
 /// way relationships.
 /// </summary>
 /// <param name="listToAdd"></param>
 #endregion
 public void AddRange(AttachableList <T> listToAdd)
 {
     for (int i = 0; i < listToAdd.Count; i++)
     {
         Add(listToAdd[i]);
     }
 }
コード例 #3
0
        /// <summary>
        /// Adds all IAttachables contained in the argument AttachableList to this
        /// without creating two-way relationships.
        /// </summary>
        /// <param name="listToAdd">The list of IAttachables to add.</param>
        #endregion
        public void AddRangeOneWay(AttachableList <T> listToAdd)
        {
            for (int i = 0; i < listToAdd.Count; i++)
            {
                mInternalList.Add(listToAdd[i]);

                if (this.CollectionChanged != null)
                {
                    // We put the index for Silverlight - but I don't want to do indexof for performance reasons so 0 it is
                    this.CollectionChanged(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, listToAdd[i], i));
                }
            }
        }
コード例 #4
0
        /// <summary>
        /// Returns the top parents in the argument AttachableList
        /// </summary>
        /// <typeparam name="OutType">The type of object in the returned list.</typeparam>
        /// <typeparam name="InType">Tye type of object in the argument list</typeparam>
        /// <param name="poa">The list to search through.</param>
        /// <returns>List of T's that are the top parents of the objects in the argument AttachableList.</returns>
        #endregion
        public static AttachableList <OutType> GetTopParents <OutType, InType>(AttachableList <InType> poa)
            where OutType : PositionedObject
            where InType : OutType, IAttachable
        {
            AttachableList <OutType> oldestParentsOneWay = new AttachableList <OutType>();

            foreach (InType po in poa)
            {
                oldestParentsOneWay.AddUniqueOneWay(po.TopParent as OutType);
            }

            return(oldestParentsOneWay);
        }
コード例 #5
0
        public AttachableList <T> FindAllWithNameContaining(string stringToSearchFor)
        {
            AttachableList <T> listToReturn = new AttachableList <T>();

            for (int i = 0; i < this.Count; i++)
            {
                T t = this[i];
                if (t.Name.Contains(stringToSearchFor))
                {
                    listToReturn.Add(t);
                }
            }

            return(listToReturn);
        }