Esempio n. 1
0
        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(DatabaseRowViewModel parent,
                              DatabaseEntity parentEntity,
                              ICommand command,
                              string actionLabel) : base(parentEntity)
 {
     Parent        = parent;
     ActionCommand = command;
     ActionLabel   = actionLabel;
     inConstructor = false;
 }
        public DatabaseCellViewModel(DatabaseRowViewModel parent,
                                     DatabaseEntity parentEntity,
                                     IParameterValue parameterValue) : base(parentEntity)
        {
            Parent         = parent;
            ParameterValue = parameterValue;

            AutoDispose(parameterValue.ToObservable().SubscribeAction(_ =>
            {
                if (!inConstructor)
                {
                    parent.AnyFieldModified();
                }
            }));
            inConstructor = false;
        }