Пример #1
0
        protected internal void insertItem(int index, TItem item)
        {
            void perform()
            {
                PreCollectionChanged?.Invoke(this, null);
                base.InsertItem(index, item);
                PostCollectionChanged?.Invoke(this, null);
            }

            ChangeMarkerField = !ChangeMarkerField;

            _currentChange = NotifyCollectionChangedAction.Add;
            _newIndex      = index;
            _newItem       = item;

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);

                perform();

                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
            }
            else
            {
                perform();
            }

            _currentChange = null;
            _newIndex      = -1;
            _newItem       = default(TItem);
        }
Пример #2
0
        protected internal void moveItem(int oldIndex, int newIndex)
        {
            void perform()
            {
                PreCollectionChanged?.Invoke(this, null);
                base.MoveItem(oldIndex, newIndex);
                PostCollectionChanged?.Invoke(this, null);
            }

            ChangeMarkerField = !ChangeMarkerField;

            _currentChange = NotifyCollectionChangedAction.Move;
            _oldIndex      = oldIndex;
            _newIndex      = newIndex;

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);

                perform();

                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
            }
            else
            {
                perform();
            }

            _currentChange = null;
            _oldIndex      = -1;
            _newIndex      = -1;
        }
Пример #3
0
        protected internal void setItem(int index, TItem item)
        {
            void perform()
            {
                PreCollectionChanged?.Invoke(this, null);
                base.SetItem(index, item);
                PostCollectionChanged?.Invoke(this, null);
            }

            TickTackVersion = !TickTackVersion;

            _currentChange = NotifyCollectionChangedAction.Replace;
            _newItem       = item;
            _newIndex      = index;
            _oldIndex      = index;

            if (OcConfiguration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);

                perform();

                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
            }
            else
            {
                perform();
            }

            _currentChange = null;
            _newItem       = default;
            _newIndex      = -1;
            _oldIndex      = -1;
        }
Пример #4
0
        protected internal void clearItems()
        {
            void perform()
            {
                PreCollectionChanged?.Invoke(this, null);
                base.ClearItems();
                PostCollectionChanged?.Invoke(this, null);
            }

            ChangeMarkerField = !ChangeMarkerField;

            _currentChange = NotifyCollectionChangedAction.Reset;

            if (Configuration.TrackComputingsExecutingUserCode)
            {
                int currentThreadId = Utils.startComputingExecutingUserCode(out IComputing computing, out _userCodeIsCalledFrom, this);

                perform();

                Utils.endComputingExecutingUserCode(computing, currentThreadId, out _userCodeIsCalledFrom);
            }
            else
            {
                perform();
            }

            _currentChange = null;
        }
        protected override void ClearItems()
        {
            ChangeMarkerField = !ChangeMarkerField;

            _currentChange = NotifyCollectionChangedAction.Reset;

            PreCollectionChanged?.Invoke(this, null);
            base.ClearItems();
            PostCollectionChanged?.Invoke(this, null);

            _currentChange = null;
        }
Пример #6
0
        protected override void ClearItems()
        {
            TickTackVersion = !TickTackVersion;

            _currentChange = NotifyCollectionChangedAction.Reset;

            PreCollectionChanged?.Invoke(this, null);
            base.ClearItems();
            PostCollectionChanged?.Invoke(this, null);

            _currentChange = null;
        }
        protected override void RemoveItem(int index)
        {
            ChangeMarkerField = !ChangeMarkerField;

            _currentChange = NotifyCollectionChangedAction.Remove;
            _oldIndex      = index;

            PreCollectionChanged?.Invoke(this, null);
            base.RemoveItem(index);
            PostCollectionChanged?.Invoke(this, null);

            _currentChange = null;
            _oldIndex      = -1;
        }
Пример #8
0
        protected override void RemoveItem(int index)
        {
            TickTackVersion = !TickTackVersion;

            _currentChange = NotifyCollectionChangedAction.Remove;
            _oldIndex      = index;

            PreCollectionChanged?.Invoke(this, null);
            base.RemoveItem(index);
            PostCollectionChanged?.Invoke(this, null);

            _currentChange = null;
            _oldIndex      = -1;
        }
        protected override void MoveItem(int oldIndex, int newIndex)
        {
            ChangeMarkerField = !ChangeMarkerField;

            _currentChange = NotifyCollectionChangedAction.Move;
            _oldIndex      = oldIndex;
            _newIndex      = newIndex;

            PreCollectionChanged?.Invoke(this, null);
            base.MoveItem(oldIndex, newIndex);
            PostCollectionChanged?.Invoke(this, null);

            _currentChange = null;
            _oldIndex      = -1;
            _newIndex      = -1;
        }
        protected override void InsertItem(int index, TItem item)
        {
            ChangeMarkerField = !ChangeMarkerField;

            _currentChange = NotifyCollectionChangedAction.Add;
            _newIndex      = index;
            _newItem       = item;

            PreCollectionChanged?.Invoke(this, null);
            base.InsertItem(index, item);
            PostCollectionChanged?.Invoke(this, null);

            _currentChange = null;
            _newIndex      = -1;
            _newItem       = default(TItem);
        }
        protected internal void setItem(int index, TItem item)
        {
            ChangeMarkerField = !ChangeMarkerField;

            _currentChange = NotifyCollectionChangedAction.Replace;
            _newItem       = item;
            _newIndex      = index;

            PreCollectionChanged?.Invoke(this, null);
            base.SetItem(index, item);
            PostCollectionChanged?.Invoke(this, null);

            _currentChange = null;
            _newItem       = default;
            _newIndex      = -1;
        }
Пример #12
0
        protected override void MoveItem(int oldIndex, int newIndex)
        {
            TickTackVersion = !TickTackVersion;

            _currentChange = NotifyCollectionChangedAction.Move;
            _oldIndex      = oldIndex;
            _newIndex      = newIndex;

            PreCollectionChanged?.Invoke(this, null);
            base.MoveItem(oldIndex, newIndex);
            PostCollectionChanged?.Invoke(this, null);

            _currentChange = null;
            _oldIndex      = -1;
            _newIndex      = -1;
        }
Пример #13
0
        protected override void SetItem(int index, TItem item)
        {
            TickTackVersion = !TickTackVersion;

            _currentChange = NotifyCollectionChangedAction.Replace;
            _newItem       = item;
            _newIndex      = index;
            _oldIndex      = index;

            PreCollectionChanged?.Invoke(this, null);
            base.SetItem(index, item);
            PostCollectionChanged?.Invoke(this, null);

            _currentChange = null;
            _newItem       = default;
            _newIndex      = -1;
            _oldIndex      = -1;
        }