private DemoCollection( ReadOnlyCollection <T> sourceItems, ObservableCollection <T> activeItems, int minCount, int maxCount, int initialCount) : base(activeItems) { m_minCount = minCount; m_maxCount = maxCount; m_initialCount = initialCount; m_activeItems = activeItems; m_sourceItems = sourceItems; m_addCommand = ActionICommand.Create(Add, canAdd, out m_onCanAddChanged); m_insertCommand = ActionICommand.Create(Insert, canAdd, out m_onCanInsertChanged); m_removeCommand = ActionICommand.Create(Remove, canRemove, out m_onCanRemoveChanged); m_moveCommand = ActionICommand.Create(Move, canMove, out m_onCanMoveChanged); m_changeCommand = ActionICommand.Create(Change, canChange, out m_onCanChangeChanged); m_resetCommand = ActionICommand.Create(Reset); activeItems.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e) { m_onCanRemoveChanged(); m_onCanAddChanged(); m_onCanMoveChanged(); m_onCanChangeChanged(); m_onCanInsertChanged(); }; }
public static ActionICommand Create(Action action, Func <bool> canExecuteFunction, out Action canExecuteChanged) { Util.RequireNotNull(action, "action"); ActionICommand command = new ActionICommand(action, canExecuteFunction); canExecuteChanged = command.onCanExecuteChanged; return(command); }
public static ActionICommand Create(Action action, Func<bool> canExecuteFunction, out Action canExecuteChanged) { Util.RequireNotNull(action, "action"); ActionICommand command = new ActionICommand(action, canExecuteFunction); canExecuteChanged = command.onCanExecuteChanged; return command; }