public AppOptionDeclarationViewModel(ApplicationPolicyViewModel appPolicyVM, AppOptionDeclarationBase decl) { AppPolicyVM = appPolicyVM; Declaration = decl; _CompositeDisposable = new CompositeDisposable(); Name = Declaration.ToReactivePropertyAsSynchronized(x => x.Name) .AddTo(_CompositeDisposable); OptionTextPattern = Declaration.ToReactivePropertyAsSynchronized(x => x.OptionTextPattern) .AddTo(_CompositeDisposable); Order = Declaration.ToReactivePropertyAsSynchronized(x => x.Order, convert: (model) => model.ToString(), convertBack: (vm) => int.Parse(vm), ignoreValidationErrorValue: true ) .AddTo(_CompositeDisposable); Order.SetValidateNotifyError(x => { if (String.IsNullOrWhiteSpace(x)) { return "Input Number"; } int temp; return int.TryParse(x, out temp) ? null : "Number Only"; }); Properties = Declaration.UserProperties.ToReadOnlyReactiveCollection( x => x.ToAppOptionPropertyVM(this) ) .AddTo(_CompositeDisposable); // TODO: OptionTextPartternとPropertiesの個数またはの内部パラメータの変更を検知して更新 //SampleOptionText = var addablePropTypes = Enum.GetValues(typeof(AddableAppOptionPropertyType)) as IEnumerable<AddableAppOptionPropertyType>; AddableProperties = addablePropTypes .Select(x => new AddablePropertyListItem(this, x.ToString(), x)) .ToList(); var isInputOption = decl is AppInputOptionDeclaration; CanAddProperty = !isInputOption; }
public AppOptionListItemViewModel(ApplicationPolicy appPolicy, AppOptionDeclarationBase decl) { AppPolicy = appPolicy; Declaration = decl; AppName = AppPolicy.AppName; OptionName = Declaration.Name; PropertyNames = Declaration .UserProperties.Select(x => x.ValiableName) .ToList(); }
public override void Rollback(AppOptionDeclarationBase other) { base.Rollback(other); InputPathProperty = _UserProperties[0] as InputAppOptionProperty; }
public override void Rollback(AppOptionDeclarationBase other) { base.Rollback(other); OutputPathProperty = UserProperties[0]; }
public virtual void Rollback(AppOptionDeclarationBase other) { this.Name = other.Name; this.Order = other.Order; this.OptionTextPattern = other.OptionTextPattern; var removePropties = this.UserProperties.ToArray(); foreach (var remProp in removePropties) { this._UserProperties.Remove(remProp); } foreach (var addProp in other.UserProperties) { this._UserProperties.Add(addProp); } }