Пример #1
0
        private void OnSourceAdd(object sender, AddEventArgs e)
        {
            if (this.TryCreateChildNode(e.Index, out var childNode))
            {
                this.Children.Insert(e.Index, childNode);
            }

            this.Changed?.Invoke(this, RootChangeEventArgs.Create(this, e));
        }
Пример #2
0
 private void TryRefreshAndNotify <T>(T e)
     where T : IRootChangeEventArgs
 {
     if (this.Builder?.TryRefresh() == true)
     {
         this.PropertyChanged?.Invoke(this, DiffPropertyChangedEventArgs);
         this.IsDirty = !this.Builder.IsEmpty;
         this.Changed?.Invoke(this, RootChangeEventArgs.Create(this, e));
     }
 }
Пример #3
0
        private void OnSourceAdd(object sender, AddEventArgs e)
        {
            IUnsubscriber <IChildNode <ChangeTrackerNode> > childNode;

            if (this.TryCreateChildNode(e.Index, out childNode))
            {
                this.Children.Insert(e.Index, childNode);
            }

            this.Changed?.Invoke(this, RootChangeEventArgs.Create(this, e));
        }
Пример #4
0
        private void OnSourceReset(object sender, ResetEventArgs e)
        {
            if (!Is.Trackable(this.ItemType))
            {
                this.Changed?.Invoke(this, RootChangeEventArgs.Create(this, e));
                return;
            }

            using (var borrow = ListPool <IUnsubscriber <IChildNode <ChangeTrackerNode> > > .Borrow())
            {
                for (var i = 0; i < this.SourceList.Count; i++)
                {
                    if (this.TryCreateChildNode(i, out var childNode))
                    {
                        borrow.Value.Add(childNode);
                    }
                }

                this.Children.Reset(borrow.Value);
                this.Changed?.Invoke(this, RootChangeEventArgs.Create(this, e));
            }
        }
Пример #5
0
 private void OnSourceMove(object sender, MoveEventArgs e)
 {
     this.Children.Move(e.FromIndex, e.ToIndex);
     this.Changed?.Invoke(this, RootChangeEventArgs.Create(this, e));
 }
Пример #6
0
 private void OnSourceReplace(object sender, ReplaceEventArgs e)
 {
     this.UpdateIndexNode(e.Index);
     this.Changed?.Invoke(this, RootChangeEventArgs.Create(this, e));
 }
Пример #7
0
 private void OnSourceRemove(object sender, RemoveEventArgs e)
 {
     this.Children.Remove(e.Index);
     this.Changed?.Invoke(this, RootChangeEventArgs.Create(this, e));
 }
Пример #8
0
 private void OnSourcePropertyChange(object sender, PropertyChangeEventArgs e)
 {
     this.UpdatePropertyNode(e.PropertyInfo);
     this.Changed?.Invoke(this, RootChangeEventArgs.Create(this, e));
 }