public void Clear() { // raise the BeforeChanged event var args = new BeforeChangedEventArgs(); BeforeChanged?.Invoke(this, args); if (args.Cancel) { return; } _currentSelection.Clear(); Changed?.Invoke(this, EventArgs.Empty); }
public void Replace(IEnumerable <IEntity> newSelection) { if (newSelection == null) { throw new ArgumentNullException(nameof(newSelection)); } // raise the BeforeChanged event var args = new BeforeChangedEventArgs(); BeforeChanged?.Invoke(this, args); if (args.Cancel) { return; } _currentSelection.Clear(); _currentSelection.AddRange(newSelection); // notify listeners Changed?.Invoke(this, EventArgs.Empty); }