public void Update(int index, CollectionViewGroupedChild current, CollectionViewGroupedChild next) { var item = _items[index]; if (!current.Header.Equals(next.Header)) { Transaction.Current.Add(() => { item.GroupHeader = next.Header; }); } // we need to issue a collection of updates to the backing list , not just a global replace ... // and this needs to run through the standard transactional approach var comparer = new MyerComparer <IPrimitive>(); comparer.Compare(current.Items, next.Items, (i, p) => { Transaction.Current.Add(() => { item.SmartInsert(i, new PrimitiveHolder() { Primitive = p }); }); }, (i, p) => { Transaction.Current.Add(() => { item.RemoveAt(i); }); ; }, (f, t, p) => { Transaction.Current.Add(() => { item.Move(f, t); }); }, (i, c, n) => { Transaction.Current.Add(() => { item[i].Primitive = n; }); } ); }
public void Update(int index, ListViewGroupedChild current, ListViewGroupedChild next) { var item = _items[index]; Transaction.Current.Add(() => { Shadow.Item.BatchBegin(); }); if (current.LongName != next.LongName) { Transaction.Current.Add(() => { item.LongName = next.LongName; }); } if (current.ShortName != next.ShortName) { Transaction.Current.Add(() => { item.ShortName = next.ShortName; }); } // we need to issue a collection of updates to the backing list , not just a global replace ... // and this needs to run through the standard transactional approach var comparer = new MyerComparer <IPrimitive>(); comparer.Compare(current.Items, next.Items, (i, p) => { Transaction.Current.Add(() => { item.SmartInsert(i, new PrimitiveHolder() { Primitive = p }); }); }, (i, p) => { Transaction.Current.Add(() => { item.RemoveAt(i); }); ; }, (f, t, p) => { Transaction.Current.Add(() => { item.Move(f, t); }); }, (i, c, n) => { Transaction.Current.Add(() => { item[i].Primitive = n; }); } ); Transaction.Current.Add(() => { Shadow.Item.BatchCommit(); }); }