Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }