public BridgeUpdater GetReplaceUpdater(IJsCsGlue glue, int index) { var bridgeUpdater = new BridgeUpdater(viewModelUpdater => Splice(viewModelUpdater, index, 1, glue)); var old = ReplaceAndReturnOld(index, glue.AddRef()); return(bridgeUpdater.CheckForRemove(old)); }
public BridgeUpdater GetReplaceUpdater(List <IJsCsGlue> glues, int index) { var bridgeUpdater = new BridgeUpdater(viewModelUpdater => Splice(viewModelUpdater, index, glues.Count, glues)); glues.ForEach(glue => glue.AddRef()); var oldChildren = glues.Select((glue, idx) => ReplaceAndReturnOld(index + idx, glue)); return(bridgeUpdater.CheckForRemove(oldChildren)); }
public BridgeUpdater GetRemoveUpdater(int index, int count) { var bridgeUpdater = new BridgeUpdater(viewModelUpdater => Splice(viewModelUpdater, index, count)); var oldChildren = Enumerable.Range(0, count).Select(_ => { var old = Items[index]; Items.RemoveAt(index); return(old); }); return(bridgeUpdater.CheckForRemove(oldChildren)); }