public bool Add(IRowEntry entry) { ObservableCollection <IRowEntry> items = this.Items; bool result; lock (items) { if (this.Get(entry.Key) != null) { result = false; } else { this._Add(entry); this.Items.Add(entry); result = true; } } return(result); }
protected void _Add(IRowEntry entry) { foreach (IValueWrapper <string> valueWrapper in entry.Cells) { ILazyUpdatable lazyUpdatable = valueWrapper as ILazyUpdatable; if (lazyUpdatable != null) { object source; if (this.Subscribed.TryGetValue(lazyUpdatable.GetSourceType(), out source)) { lazyUpdatable.Update(source); } Dictionary <Type, LinkedList <ILazyUpdatable> > lazyBindings = this.LazyBindings; lock (lazyBindings) { this.LazyBindings.Append(lazyUpdatable.GetSourceType(), lazyUpdatable); } } } }
protected void _Remove(IRowEntry entry) { foreach (IValueWrapper <string> valueWrapper in entry.Cells) { ILazyUpdatable lazyUpdatable = valueWrapper as ILazyUpdatable; if (lazyUpdatable != null) { Dictionary <Type, LinkedList <ILazyUpdatable> > lazyBindings = this.LazyBindings; lock (lazyBindings) { this.LazyBindings[lazyUpdatable.GetSourceType()].Remove(lazyUpdatable); } } } IDisposable disposable = entry as IDisposable; if (disposable != null) { disposable.Dispose(); } }
public IRowEntry GetOrAdd(string key, Func <IRowEntry> factory) { ObservableCollection <IRowEntry> items = this.Items; IRowEntry result; lock (items) { IRowEntry rowEntry = this.Get(key); if (rowEntry != null) { result = rowEntry; } else { rowEntry = factory(); this._Add(rowEntry); this.Items.Add(rowEntry); result = rowEntry; } } return(result); }
public bool Remove(IRowEntry entry) { IRowEntry rowEntry = null; ObservableCollection <IRowEntry> items = this.Items; bool result; lock (items) { rowEntry = this.Get(entry.Key); if (rowEntry != null) { this.Items.Remove(rowEntry); goto IL_42; } result = false; } return(result); IL_42: this._Remove(rowEntry); return(true); }