public PropertyValueViewModel(PropertyValue item, IPropertyViewModel parent) { InnerItem = item; ParentCatalog = parent.ParentCatalog; IsMultiLanguage = parent.InnerItem.IsLocaleDependant; var itemValueType = (PropertyValueType)InnerItem.ValueType; IsShortStringValue = itemValueType == PropertyValueType.ShortString; IsLongStringValue = itemValueType == PropertyValueType.LongString; IsDecimalValue = itemValueType == PropertyValueType.Decimal; IsIntegerValue = itemValueType == PropertyValueType.Integer; IsBooleanValue = itemValueType == PropertyValueType.Boolean; IsDateTimeValue = itemValueType == PropertyValueType.DateTime; }
public BlockViewModel(IPropertyViewModel model) { Model.Value = model; CloseCommand.Subscribe(x => Messenger.Raise(new WindowActionMessage(WindowAction.Close, "Close"))); Model.Value.OnError.Subscribe(e => ShowError(e, "エラー")); }
public CollectionViewModel(TProperty property, ViewModelFactory factory) : base(property) { Collection = property.Collection.ToReadOnlyReactiveCollection(x => { IPropertyViewModel vm = null; try { vm = factory.Create(x); } catch (Exception e) { OnErrorSubject.OnNext(e); return(null); } vm.OnChanged.Subscribe(y => OnChangedSubject.OnNext(Unit.Default)); vm.OnError.Subscribe(e => OnErrorSubject.OnNext(e)); return(vm); }); FormatedString = Property.Count.Select(x => $"Count = {x}") .ToReactiveProperty(mode: ReactivePropertyMode.RaiseLatestValueOnSubscribe); AddCommand.Subscribe(x => { try { Property.AddNewElement(); } catch (Exception e) { OnErrorSubject.OnNext(e); } OnChangedSubject.OnNext(Unit.Default); }); RemoveCommand.Subscribe(x => { try { Property.RemoveElementAt(x); } catch (Exception e) { OnErrorSubject.OnNext(e); } OnChangedSubject.OnNext(Unit.Default); }); EditCommand.Subscribe(x => ShowDetailSubject.OnNext(this)); UpCommand.Subscribe(x => { Property.Move(x - 1, x); SelectedIndex.Value = x - 1; }); DownCommand.Subscribe(x => { Property.Move(x + 1, x); SelectedIndex.Value = x; }); DuplicateCommand.Subscribe(x => { Property.Duplicate(x, x + 1); }); }
protected PropertyDecorator(IPropertyViewModel <T> property) { _property = property; _property.PropertyChanged += PropertyViewModelPropertyChanged; }
public RequiredPropertyDecorator(IPropertyViewModel <T> property) : base(property) { }