internal Synchronizer(INotifyPropertyChanged source, INotifyPropertyChanged target, PropertiesSettings settings)
 {
     this.Settings = settings;
     this.dirtyTrackerNode = DirtyTrackerNode.GetOrCreate(source, target, settings, true);
     this.dirtyTrackerNode.Value.Changed += this.OnDirtyTrackerNodeChanged;
     this.borrowedQueue = ConcurrentQueuePool<DirtyTrackerNode>.Borrow();
     this.AddToSyncQueue(this.dirtyTrackerNode.Value);
 }
示例#2
0
 public Borrowed(IBorrowed borrowed)
 {
     if (borrowed != null)
     {
         this.FirstName = borrowed.GetFirstName();
         this.LastName  = borrowed.GetLastName();
         this.From      = borrowed.GetFrom();
     }
 }
示例#3
0
            internal Synchronizer(INotifyPropertyChanged source, INotifyPropertyChanged target, PropertiesSettings settings)
            {
                this.Settings         = settings;
                this.dirtyTrackerNode = DirtyTrackerNode.GetOrCreate(source, target, settings, true);
                this.dirtyTrackerNode.Value.Changed += this.OnDirtyTrackerNodeChanged;
                this.borrowedQueue = ConcurrentQueuePool <DirtyTrackerNode> .Borrow();

                this.AddToSyncQueue(this.dirtyTrackerNode.Value);
            }
示例#4
0
        private DiffBuilder(IRefCounted <ReferencePair> refCountedPair, MemberSettings settings)
        {
            this.refCountedPair = refCountedPair;
            this.settings       = settings;
            this.borrowedDiffs  = DictionaryPool <object, SubDiff> .Borrow();

            this.borrowedSubBuilders = DictionaryPool <object, IRefCounted <DiffBuilder> > .Borrow();

            this.valueDiff = new ValueDiff(refCountedPair.Value.X, refCountedPair.Value.Y, this.diffs);
        }
示例#5
0
        private ChangeTrackerNode(object source, PropertiesSettings settings, bool isRoot)
        {
            this.refcountedRootChanges = RootChanges.GetOrCreate(source, settings, isRoot);
            var sourceChanges = this.refcountedRootChanges.Value;

            this.children = ChildNodes <ChangeTrackerNode> .Borrow();

            sourceChanges.PropertyChange += this.OnSourcePropertyChange;
            if (Is.NotifyingCollection(source))
            {
                this.ItemType = this.SourceList.GetType()
                                .GetItemType();
                sourceChanges.Add     += this.OnSourceAdd;
                sourceChanges.Remove  += this.OnSourceRemove;
                sourceChanges.Replace += this.OnSourceReplace;
                sourceChanges.Move    += this.OnSourceMove;
                sourceChanges.Reset   += this.OnSourceReset;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="DirtyTrackerNode"/> class.
        /// A call to Initialize is needed after the ctor due to that we need to fetch child nodes and the graph can contain self
        /// </summary>
        private DirtyTrackerNode(IRefCounted <ReferencePair> refCountedPair, PropertiesSettings settings, bool isRoot)
        {
            this.refCountedPair = refCountedPair;
            var x = refCountedPair.Value.X;
            var y = refCountedPair.Value.Y;

            this.children = ChildNodes <DirtyTrackerNode> .Borrow();

            this.xNode = RootChanges.GetOrCreate(x, settings, isRoot);
            this.yNode = RootChanges.GetOrCreate(y, settings, isRoot);
            this.xNode.Value.PropertyChange += this.OnTrackedPropertyChange;
            this.yNode.Value.PropertyChange += this.OnTrackedPropertyChange;

            this.IsTrackingCollectionItems = Is.Enumerable(x, y) &&
                                             !settings.IsImmutable(x.GetType().GetItemType()) &&
                                             !settings.IsImmutable(y.GetType().GetItemType());

            if (Is.NotifyingCollections(x, y))
            {
                this.xNode.Value.Add     += this.OnTrackedAdd;
                this.xNode.Value.Remove  += this.OnTrackedRemove;
                this.xNode.Value.Replace += this.OnTrackedReplace;
                this.xNode.Value.Move    += this.OnTrackedMove;
                this.xNode.Value.Reset   += this.OnTrackedReset;

                this.yNode.Value.Add     += this.OnTrackedAdd;
                this.yNode.Value.Remove  += this.OnTrackedRemove;
                this.yNode.Value.Replace += this.OnTrackedReplace;
                this.yNode.Value.Move    += this.OnTrackedMove;
                this.yNode.Value.Reset   += this.OnTrackedReset;
            }

            var builder = DiffBuilder.GetOrCreate(x, y, settings);

            builder.Value.UpdateDiffs(x, y, settings);
            builder.Value.Refresh();
            this.refcountedDiffBuilder = builder;
            this.isDirty = !this.Builder.IsEmpty;
        }