public void TriggerChanged(NotifyingSortedSet <TItem> oldValue, NotifyingSortedSet <TItem> newValue) { if (this.Changed == null) { return; } ChangTransaction.Perform(delegate(ChangTransaction t) { ValueChangingEventArgs <NotifyingSortedSet <TItem> > e = new ValueChangingEventArgs <NotifyingSortedSet <TItem> >(oldValue, newValue, t); this.Changed(this, e); }); }
public Store(string memId) { MemberId = memId; _ships = new Dictionary <int, Ship>(); _logbookSequence = new NotifyingSortedSet <ulong>(); BasicInfo = new BasicInfo(this); Settings = new Settings(); Weekbook = new Weekbook(this); _logbookSequence.Add(0); Ships = new ShipsAccessor(this); Logbooks = new LogbookAccessor(this); LogbookSequence = new NotifyingReadOnlyCollectionWrapper <ulong>(_logbookSequence, _logbookSequence); }
public bool TriggerChanging(NotifyingSortedSet <TItem> oldValue, NotifyingSortedSet <TItem> newValue) { if (this.Changing == null) { return(true); } return(ChangTransaction.Perform(delegate(ChangTransaction t) { ValueChangingEventArgs <NotifyingSortedSet <TItem> > e = new ValueChangingEventArgs <NotifyingSortedSet <TItem> >(oldValue, newValue, t); this.Changing(this, e); return !e.Cancel; })); }
public bool SetValue(NotifyingSortedSet <TItem> collection) { if (this._collection == collection) { return(true); } if (!this.TriggerChanging(this._collection, collection)) { return(false); // Veto } NotifyingSortedSet <TItem> oldValue = this._collection; if (this._collection != null) { this._collection.Changed -= new CollectionChangedEventHandler(this.TriggerCollectionChanged); } this._collection = collection; if (this._collection != null) { this._collection.Changed += new CollectionChangedEventHandler(this.TriggerCollectionChanged); } this.TriggerChanged(oldValue, collection); return(true); }