/// <summary> /// Initializes a new instance of the <see cref="GroupWidgetOptionsViewModel"/> class. /// </summary> public GroupWidgetOptionsViewModel([NotNull] string windowTitle, [NotNull] IEnumerable <AffectDescription> availableAffects, [NotNull] IEnumerable <AffectDescription> displayedAffects, int displayedAffectsCount, bool displayNumber, bool displayMemTime, bool allowChangeDisplayMemTime, bool itemLimitOn, int itemLimit) { _displayedAffectsCount = displayedAffectsCount; _displayNumber = displayNumber; _displayMemTime = displayMemTime; _allowChangeDisplayMemTime = allowChangeDisplayMemTime; Assert.ArgumentNotNullOrWhiteSpace(windowTitle, "windowTitle"); Assert.ArgumentNotNull(availableAffects, "availableAffects"); Assert.ArgumentNotNull(displayedAffects, "displayedAffects"); WindowTitle = windowTitle; ItemLimitOn = itemLimitOn; ItemLimit = itemLimit; AvailableAffects = new ObservableCollection <AffectDescription>(availableAffects); DisplayedAffects = new ObservableCollection <AffectDescription>(displayedAffects); AddDisplayedAffectCommand = new DelegateCommandWithCanExecute(AddDisplayedAffectCommandExecute, AddDisplayedAffectCommandCanExecute); RemoveDisplayedAffectCommand = new DelegateCommandWithCanExecute(RemoveDisplayedAffectCommandExecute, RemoveDisplayedAffectCommandCanExecute); MoveDisplayedAffectUpCommand = new DelegateCommandWithCanExecute(MoveDisplayedAffectUpCommandExecute, MoveDisplayedAffectUpCommandCanExecute); MoveDisplayedAffectDownCommand = new DelegateCommandWithCanExecute(MoveDisplayedAffectDownCommandExecute, MoveDisplayedAffectDownCommandCanExecute); }
/// <summary> /// Initializes a new instance of the <see cref="ActionParametersViewModel"/> class. /// </summary> /// <param name="parameters">The parameters.</param> /// <param name="parameterDescriptions">The parameter descriptions.</param> public ActionParametersViewModel([NotNull] IList <ActionParameterBase> parameters, [NotNull] IEnumerable <ParameterDescription> parameterDescriptions) { Assert.ArgumentNotNull(parameters, "parameters"); Assert.ArgumentNotNull(parameterDescriptions, "parameterDescriptions"); _originalParameters = parameters; ParameterDescriptions = parameterDescriptions; foreach (var originalParameter in _originalParameters) { var parameter = CreateParameterViewModel(originalParameter, ParameterDescriptions); parameter.ParameterTypeChanged += ChangeParameterType; parameter.PropertyChanged += HandleParameterDescriptionChanged; _parameters.Add(parameter); } Parameters = new ReadOnlyObservableCollection <ActionParameterViewModelBase>(_parameters); AddParameterCommand = new DelegateCommand(AddParameterCommandExecute); DeleteParameterCommand = new DelegateCommand(DeleteParameterCommandExecute); MoveParameterUpCommand = new DelegateCommandWithCanExecute(MoveParameterUpCommandExecute, MoveParameterUpCommandCanExecute); MoveParameterDownCommand = new DelegateCommandWithCanExecute(MoveParameterDownCommandExecute, MoveParameterDownCommandCanExecute); }
/// <summary> /// Initializes a new instance of the <see cref="ActionsViewModel"/> class. /// </summary> /// <param name="actions">The actions.</param> /// <param name="actionDescriptions">The action descriptions.</param> /// <param name="allowDeleteLastAction">if set to <c>true</c> [allow delete last action].</param> public ActionsViewModel([NotNull] IList <ActionBase> actions, [NotNull] IEnumerable <ActionDescription> actionDescriptions, bool allowDeleteLastAction = false) { Assert.ArgumentNotNull(actions, "actions"); Assert.ArgumentNotNull(actionDescriptions, "actionDescriptions"); _originalActions = actions; _allowDeleteLastAction = allowDeleteLastAction; ActionDescriptions = actionDescriptions; _actions = new ObservableCollection <ActionViewModelBase>(); Actions = new ReadOnlyObservableCollection <ActionViewModelBase>(_actions); AddActionCommand = new DelegateCommand(AddActionCommandExecute, true); AddFirstActionCommand = new DelegateCommand(AddFirstActionCommandExecute, true); RemoveActionCommand = new DelegateCommandWithCanExecute(RemoveActionCommandExecute, RemoveActionCommandCanExecute); MoveActionUpCommand = new DelegateCommandWithCanExecute(MoveActionUpCommandExecute, MoveActionUpCommandCanExecute); MoveActionDownCommand = new DelegateCommandWithCanExecute(MoveActionDownCommandExecute, MoveActionDownCommandCanExecute); foreach (var originalAction in _originalActions) { var newAction = CreateActionViewModel(originalAction, actionDescriptions); newAction.PropertyChanged += HandleActionDescriptionChange; newAction.ActionTypeChanged += ChangeActionType; _actions.Add(newAction); } }