Beispiel #1
0
        public SelectionScope RegisterSelectionScope([NotNull] Func <AbsoluteId, object> idToObject, [NotNull] Func <object, AbsoluteId?> objectToId, [NotNull] params INotifyCollectionChanged[] collections)
        {
            if (idToObject == null)
            {
                throw new ArgumentNullException(nameof(idToObject));
            }
            if (objectToId == null)
            {
                throw new ArgumentNullException(nameof(objectToId));
            }
            if (collections == null)
            {
                throw new ArgumentNullException(nameof(collections));
            }

            var scope = new SelectionScope(collections, idToObject, objectToId);

            foreach (var collection in scope.Collections)
            {
                collection.CollectionChanged += CollectionChanged;
            }
            scopes.Add(scope);
            // Update history to let it know about this collection
            foreach (var operation in stack.RetrieveAllTransactions().SelectMany(x => x.Operations).OfType <SelectionOperation>())
            {
                foreach (var collection in scope.Collections)
                {
                    operation.RegisterCollection(scope, collection);
                }
            }
            // Also update the current state
            foreach (var collection in scope.Collections)
            {
                CurrentState.RegisterCollection(scope, collection);
            }

            return(scope);
        }
Beispiel #2
0
 public IEnumerable <IReadOnlyTransaction> RetrieveAllTransactions() => stack.RetrieveAllTransactions();