Beispiel #1
0
 public void ClearReferences()
 {
     if (accessor.IsReference)
     {
         foreach (var item in items)
         {
             references.OnAssigningNull(item.Node, item.Value);
         }
     }
 }
Beispiel #2
0
        protected void RemoveCollectionItems(IXmlNode parentNode, XmlReferenceManager references, object value)
        {
            var collection = value as ICollectionProjection;

            if (collection != null)
            {
                collection.Clear();
                return;
            }

            var itemType    = clrType.GetCollectionItemType();
            var accessor    = GetCollectionAccessor(itemType);
            var cursor      = accessor.SelectCollectionItems(parentNode, true);
            var isReference = IsReference;

            var items = value as IEnumerable;

            if (items != null)
            {
                foreach (var item in items)
                {
                    if (!cursor.MoveNext())
                    {
                        break;
                    }
                    if (isReference)
                    {
                        references.OnAssigningNull(cursor, item);
                    }
                }
            }

            cursor.Reset();
            cursor.RemoveAllNext();
        }
Beispiel #3
0
        private void RemoveCore(int index)
        {
            EndNew(addedIndex);

            var item = items[index];

            DetachPropertyChanged(item.Value);
            if (accessor.IsReference)
            {
                references.OnAssigningNull(item.Node, item.Value);
            }

            cursor.MoveTo(item.Node);
            cursor.Remove();
            items.RemoveAt(index);

            NotifyListChanged(ListChangedType.ItemDeleted, index);
        }
Beispiel #4
0
		protected void RemoveCollectionItems(IXmlNode parentNode, XmlReferenceManager references, object value)
		{
			var collection = value as ICollectionProjection;
			if (collection != null)
			{
				collection.Clear();
				return;
			}

			var itemType    = clrType.GetCollectionItemType();
			var accessor    = GetCollectionAccessor(itemType);
			var cursor      = accessor.SelectCollectionItems(parentNode, true);
			var isReference = IsReference;

			var items = value as IEnumerable;
			if (items != null)
			{
				foreach (var item in items)
				{
					if (!cursor.MoveNext())
						break;
					if (isReference)
						references.OnAssigningNull(cursor, item);
				}
			}

			cursor.Reset();
			cursor.RemoveAllNext();
		}