public void AddTarget(IUniqueObject targetObject) { if (WidgetShowHideAction != null) { WidgetShowHideAction.AddTargetObject(targetObject.Guid); SetShowHideAction(); //current action is not "Check All" if (!_isCheckAllAction) { if (CurrentUndoManager != null) { //widget AddTargetCommand cmd = new AddTargetCommand(this, targetObject.Guid, _selectedWidget == null ? Guid.Empty : _selectedWidget.Guid); CurrentUndoManager.Push(cmd); } //if all is checked , set IsCheckAll to true. var node = WidgetList.FirstOrDefault(a => a.IsSelected == false); if (node == null) { _isCheckAll = true; FirePropertyChanged("IsCheckAll"); } } FirePropertyChanged("ShowHideType"); FirePropertyChanged("AnimateType"); FirePropertyChanged("AnimateTime"); FirePropertyChanged("IsShowHideEnabled"); } }
/// <summary> /// Undo add every widget in the group to object list. /// </summary> /// <param name="targetObject"> group</param> /// <param name="cmds"></param> private void UndoAddGroupTarget(IGroup targetGroup, UndoCompositeCommand cmds) { foreach (IGroup group in targetGroup.Groups) { UndoAddGroupTarget(group, cmds); } foreach (IWidget target in targetGroup.Widgets) { AddTargetCommand cmd = new AddTargetCommand(this, target.Guid, _selectedWidget == null ? Guid.Empty : _selectedWidget.Guid); cmds.AddCommand(cmd); } }