public SingleRecordDatabaseCellViewModel(int columnIndex, DatabaseColumnJson columnDefinition, DatabaseEntityViewModel parent, DatabaseEntity parentEntity, IDatabaseField tableField, IParameterValue parameterValue) : base(parentEntity) { ColumnIndex = columnIndex * 2; CanBeNull = columnDefinition.CanBeNull; IsReadOnly = columnDefinition.IsReadOnly; ColumnName = columnDefinition.Name; Parent = parent; TableField = tableField; ParameterValue = parameterValue; if (UseItemPicker) { AutoDispose(ParameterValue.ToObservable().Subscribe(_ => RaisePropertyChanged(nameof(OptionValue)))); } if (UseFlagsPicker) { AutoDispose(ParameterValue.ToObservable().Subscribe(_ => RaisePropertyChanged(nameof(AsLongValue)))); } OriginalValueTooltip = tableField.IsModified ? "Original value: " + parameterValue.OriginalString : null; AutoDispose(parameterValue.ToObservable("Value").Skip(1).SubscribeAction(_ => { Parent.RaiseChanged(this, tableField.FieldName); OriginalValueTooltip = tableField.IsModified ? "Original value: " + parameterValue.OriginalString : null; RaisePropertyChanged(nameof(OriginalValueTooltip)); RaisePropertyChanged(nameof(AsBoolValue)); RaisePropertyChanged(nameof(IsModified)); })); }
public DatabaseCellViewModel(DatabaseRowViewModel parent, DatabaseEntity parentEntity, IDatabaseField tableField, IParameterValue parameterValue, IObservable <bool>?cellIsVisible) { Link(tableField, tf => tf.IsModified, () => IsModified); ParentEntity = parentEntity; Parent = parent; TableField = tableField; ParameterValue = parameterValue; if (cellIsVisible != null) { AutoDispose(cellIsVisible.Subscribe(v => { IsVisible = v; RaisePropertyChanged(nameof(IsVisible)); })); } AutoDispose(parameterValue.ToObservable().SubscribeAction(_ => { if (!inConstructor) { parent.AnyFieldModified(); } OriginalValueTooltip = tableField.IsModified ? "Original value: " + parameterValue.OriginalString : null; RaisePropertyChanged(nameof(OriginalValueTooltip)); RaisePropertyChanged(nameof(AsBoolValue)); })); inConstructor = false; }
public DatabaseCellViewModel(int columnIndex, DatabaseColumnJson columnDefinition, DatabaseEntityViewModel parent, DatabaseEntity parentEntity, IDatabaseField tableField, IParameterValue parameterValue) : base(parentEntity) { ColumnIndex = columnIndex * 2; CanBeNull = columnDefinition.CanBeNull; IsReadOnly = columnDefinition.IsReadOnly; ColumnName = columnDefinition.Name; DbColumnName = columnDefinition.DbColumnName; Parent = parent; TableField = tableField; ParameterValue = parameterValue; if (UseItemPicker) { AutoDispose(ParameterValue.ToObservable().Subscribe(_ => RaisePropertyChanged(nameof(OptionValue)))); } if (UseFlagsPicker) { AutoDispose(ParameterValue.ToObservable().Subscribe(_ => RaisePropertyChanged(nameof(AsLongValue)))); } AutoDispose(parameterValue.ToObservable().SubscribeAction(_ => { OriginalValueTooltip = tableField.IsModified ? "Original value: " + parameterValue.OriginalString : null; RaisePropertyChanged(nameof(OriginalValueTooltip)); RaisePropertyChanged(nameof(AsBoolValue)); })); if (parameterValue.BaseParameter is DatabaseStringContextualParameter contextual) { var other = parent.Cells.FirstOrDefault(c => c.DbColumnName == contextual.Column); if (other != null) { AutoDispose(other.ParameterValue !.ToObservable().Subscribe(_ => { parameterValue.RaiseChanged(); })); } else { Console.WriteLine("Couldn't find column " + contextual.Column); } } }
public DatabaseCellViewModel(DatabaseRowViewModel parent, DatabaseEntity parentEntity, IParameterValue parameterValue) : base(parentEntity) { Parent = parent; ParameterValue = parameterValue; AutoDispose(parameterValue.ToObservable().SubscribeAction(_ => { if (!inConstructor) { parent.AnyFieldModified(); } })); inConstructor = false; }
public DatabaseCellViewModel(int columnIndex, DatabaseColumnJson columnDefinition, DatabaseEntityViewModel parent, DatabaseEntity parentEntity, IDatabaseField tableField, IParameterValue parameterValue) { ColumnIndex = columnIndex * 2; CanBeNull = columnDefinition.CanBeNull; IsReadOnly = columnDefinition.IsReadOnly; ColumnName = columnDefinition.DbColumnName; ParentEntity = parentEntity; Parent = parent; TableField = tableField; ParameterValue = parameterValue; AutoDispose(parameterValue.ToObservable().SubscribeAction(_ => { OriginalValueTooltip = tableField.IsModified ? "Original value: " + parameterValue.OriginalString : null; RaisePropertyChanged(nameof(OriginalValueTooltip)); RaisePropertyChanged(nameof(AsBoolValue)); })); }