示例#1
0
        public EditableSet(IBindableCollection <TElement> originals, Action <TElement> editItemAction, Action <TElement> addItemAction, Action <TElement> deleteItemAction)
        {
            _originals        = originals;
            _deleteItemAction = deleteItemAction;
            _addItemAction    = addItemAction;
            _editItemAction   = editItemAction;

            _inserted          = new ObservableCollection <Editable <TElement> >();
            _editableOriginals = _originals.AsBindable().Select(orig => new Editable <TElement>(orig));
            _editableOriginals.Evaluate();

            _undoItemChangesCommand = new DelegateCommand <Editable <TElement> >(
                item => UndoItemChanges(item),
                item => item.HasChanges
                );
            _deleteItemCommand = new DelegateCommand <Editable <TElement> >(
                item => DeleteItem(item),
                item => true
                );
            _undoChangesCommand = new DelegateCommand(
                ignored => UndoChanges(),
                ignored => true
                );
            _commitChangesCommand = new DelegateCommand(
                ignored => CommitChanges(),
                ignored => true
                );
        }
 public IteratorQueryNode(IBindableCollection query)
 {
     _iterator = query;
     _events   = new ObservableCollection <IQueryNodeEvent>();
     _iterator.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e)
     {
         _events.Add(new NotifyCollectionChangedQueryNodeEvent(e));
     };
     _iterator.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
     {
         _events.Add(new PropertyChangedQueryNodeEvent(e));
     };
     _childNodes = _iterator.AsBindable <object>()
                   .Select(c => QueryNodeFactory.Create(c));
 }
 public IteratorQueryNode(IBindableCollection query)
 {
     _iterator = query;
     _events = new ObservableCollection<IQueryNodeEvent>();
     _iterator.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e)
         {
             _events.Add(new NotifyCollectionChangedQueryNodeEvent(e));
         };
     _iterator.PropertyChanged += delegate(object sender, PropertyChangedEventArgs e)
     {
         _events.Add(new PropertyChangedQueryNodeEvent(e));
     };
     _childNodes = _iterator.AsBindable<object>()
                            .Select(c => QueryNodeFactory.Create(c));
 }