Esempio n. 1
0
        internal virtual void RemoveItemAt(int index)
        {
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index", "Index is less than 0.");
            }
            if (index >= ChildrenTokens.Count)
            {
                throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count.");
            }
            CheckReentrancy();
            JToken jToken  = ChildrenTokens[index];
            JToken jToken2 = ((index == 0) ? null : ChildrenTokens[index - 1]);
            JToken jToken3 = ((index == ChildrenTokens.Count - 1) ? null : ChildrenTokens[index + 1]);

            if (jToken2 != null)
            {
                jToken2.Next = jToken3;
            }
            if (jToken3 != null)
            {
                jToken3.Previous = jToken2;
            }
            jToken.Parent   = null;
            jToken.Previous = null;
            jToken.Next     = null;
            ChildrenTokens.RemoveAt(index);
            OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
        }
Esempio n. 2
0
        internal virtual void RemoveItemAt(int index)
        {
            if (index < 0)
                throw new ArgumentOutOfRangeException("index", "Index is less than 0.");
            if (index >= ChildrenTokens.Count)
                throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count.");

            CheckReentrancy();

            JToken item = ChildrenTokens[index];
            JToken previous = (index == 0) ? null : ChildrenTokens[index - 1];
            JToken next = (index == ChildrenTokens.Count - 1) ? null : ChildrenTokens[index + 1];

            if (previous != null)
                previous.Next = next;
            if (next != null)
                next.Previous = previous;

            item.Parent = null;
            item.Previous = null;
            item.Next = null;

            ChildrenTokens.RemoveAt(index);

#if !(NETFX_CORE || PORTABLE40 || PORTABLE)
            if (_listChanged != null)
                OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
#endif
#if !(NET20 || NET35 || PORTABLE40)
            if (_collectionChanged != null)
                OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, index));
#endif
        }
Esempio n. 3
0
        internal virtual void RemoveItemAt(int index)
        {
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index", "Index is less than 0.");
            }
            if (index >= ChildrenTokens.Count)
            {
                throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count.");
            }

            CheckReentrancy();

            JToken item     = ChildrenTokens[index];
            JToken previous = (index == 0) ? null : ChildrenTokens[index - 1];
            JToken next     = (index == ChildrenTokens.Count - 1) ? null : ChildrenTokens[index + 1];

            if (previous != null)
            {
                previous.Next = next;
            }
            if (next != null)
            {
                next.Previous = previous;
            }

            item.Parent   = null;
            item.Previous = null;
            item.Next     = null;

            ChildrenTokens.RemoveAt(index);
        }
Esempio n. 4
0
        internal virtual void RemoveItemAt(int index)
        {
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index", "Index is less than 0.");
            }
            if (index >= ChildrenTokens.Count)
            {
                throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count.");
            }

            CheckReentrancy();

            JToken item     = ChildrenTokens[index];
            JToken previous = (index == 0) ? null : ChildrenTokens[index - 1];
            JToken next     = (index == ChildrenTokens.Count - 1) ? null : ChildrenTokens[index + 1];

            if (previous != null)
            {
                previous.Next = next;
            }
            if (next != null)
            {
                next.Previous = previous;
            }

            item.Parent   = null;
            item.Previous = null;
            item.Next     = null;

            //IList implementation is broken on Web Player (Unity Bug) and RemoveAt will not remove the item
#if !UNITY_WEBPLAYER
            ChildrenTokens.RemoveAt(index);
#else
            if (ChildrenTokens is JObject.JPropertKeyedCollection)
            {
                (ChildrenTokens as JObject.JPropertKeyedCollection).RemoveItemAt(index);
            }
#endif

#if !(UNITY_ANDROID || (UNITY_IOS || UNITY_IPHONE) || (UNITY_WP8 || UNITY_WP_8_1) || (UNITY_WINRT && !UNITY_EDITOR))
            OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
#endif
        }
Esempio n. 5
0
        internal virtual void RemoveItemAt(int index)
        {
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index", "Index is less than 0.");
            }
            if (index >= ChildrenTokens.Count)
            {
                throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count.");
            }

            CheckReentrancy();

            var item     = ChildrenTokens[index];
            var previous = (index == 0) ? null : ChildrenTokens[index - 1];
            var next     = (index == ChildrenTokens.Count - 1) ? null : ChildrenTokens[index + 1];

            if (previous != null)
            {
                previous.Next = next;
            }
            if (next != null)
            {
                next.Previous = previous;
            }

            item.Parent   = null;
            item.Previous = null;
            item.Next     = null;

            ChildrenTokens.RemoveAt(index);

            if (_listChanged != null)
            {
                OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
            }
            if (_collectionChanged != null)
            {
                OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, index));
            }
        }
Esempio n. 6
0
        internal virtual void RemoveItemAt(int index)
        {
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index", "Index is less than 0.");
            }
            if (index >= ChildrenTokens.Count)
            {
                throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count.");
            }

            CheckReentrancy();

            JToken item     = ChildrenTokens[index];
            JToken previous = (index == 0) ? null : ChildrenTokens[index - 1];
            JToken next     = (index == ChildrenTokens.Count - 1) ? null : ChildrenTokens[index + 1];

            if (previous != null)
            {
                previous.Next = next;
            }
            if (next != null)
            {
                next.Previous = previous;
            }

            item.Parent   = null;
            item.Previous = null;
            item.Next     = null;

            ChildrenTokens.RemoveAt(index);

#if !(SILVERLIGHT || MONODROID || MONOTOUCH)
            OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
#endif
#if !MONOTOUCH && SILVERLIGHT || !(NET20 || NET35)
            OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Remove, item, index));
#endif
        }
Esempio n. 7
0
        internal virtual void RemoveItemAt(int index)
        {
            if (index < 0)
            {
                throw new ArgumentOutOfRangeException("index", "Index is less than 0.");
            }
            if (index >= ChildrenTokens.Count)
            {
                throw new ArgumentOutOfRangeException("index", "Index is equal to or greater than Count.");
            }

            CheckReentrancy();

            JToken item     = ChildrenTokens[index];
            JToken previous = (index == 0) ? null : ChildrenTokens[index - 1];
            JToken next     = (index == ChildrenTokens.Count - 1) ? null : ChildrenTokens[index + 1];

            if (previous != null)
            {
                previous.Next = next;
            }
            if (next != null)
            {
                next.Previous = previous;
            }

            item.Parent   = null;
            item.Previous = null;
            item.Next     = null;

            ChildrenTokens.RemoveAt(index);

#if !(UNITY_ANDROID || (UNITY_IOS || UNITY_IPHONE) || UNITY_WP8 || (UNITY_WINRT && !UNITY_EDITOR))
            OnListChanged(new ListChangedEventArgs(ListChangedType.ItemDeleted, index));
#endif
        }