Esempio n. 1
0
 public SingleParameter(string name, double value, double min, double max, int index = -1, ValueBinding binder = null)
 {
     _name   = name;
     Value   = value;
     Min     = min;
     Max     = max;
     Index   = index;
     _binder = binder;
 }
Esempio n. 2
0
        public void WhenSourceValueChangedAndIsNoValueThenTargetValueShouldNotBeChanged()
        {
            var sourceAdapter = new ValueAdapter();
            var targetAdapter = new ValueAdapter();
            var binding       = new ValueBinding(targetAdapter, sourceAdapter);

            sourceAdapter.ValueChangedCallback(SettingsConstants.NoValue);

            Assert.IsFalse(targetAdapter.SetValueCalled);
        }
Esempio n. 3
0
        public void WhenTargetValueChangesItShouldBePassedToSource()
        {
            var sourceAdapter = new ValueAdapter();
            var targetAdapter = new ValueAdapter();
            var binding       = new ValueBinding(targetAdapter, sourceAdapter);

            targetAdapter.ValueChangedCallback(5);

            Assert.AreEqual(5, sourceAdapter.Value);
        }
        /// <summary>
        /// Disconnected events from the bound property.
        /// </summary>
        public void Disconnect()
        {
            if (this.parentObject == null)
            {
                return;
            }

            ValueBinding.Disconnect();

            parentObject = null;
        }
Esempio n. 5
0
 protected override string?GetSortExpression()
 {
     if (string.IsNullOrEmpty(SortExpression))
     {
         return(ValueBinding?.GetProperty <OriginalStringBindingProperty>()?.Code ??
                throw new DotvvmControlException(this, $"The 'ValueBinding' property must be set on the '{GetType()}' control!"));
     }
     else
     {
         return(SortExpression);
     }
 }
Esempio n. 6
0
        public void UpdateTargetShouldNotPassNoValueFromSourceToTarget()
        {
            var sourceAdapter = new ValueAdapter();
            var targetAdapter = new ValueAdapter();
            var binding       = new ValueBinding(targetAdapter, sourceAdapter);

            sourceAdapter.Value = SettingsConstants.NoValue;

            binding.UpdateTarget();

            Assert.IsFalse(targetAdapter.SetValueCalled);
        }
Esempio n. 7
0
        public void UpdateTargetShouldPassValueFromSourceToTarget()
        {
            var sourceAdapter = new ValueAdapter();
            var targetAdapter = new ValueAdapter();
            var binding       = new ValueBinding(targetAdapter, sourceAdapter);

            sourceAdapter.Value = 5;

            binding.UpdateTarget();

            Assert.AreEqual(5, sourceAdapter.Value);
        }
Esempio n. 8
0
        public void Binding()
        {
            IDisposable binding = new ValueBinding <int>(left, right);

            left.Set(1);

            Assert.Equal(1, right.Get());

            right.Set(2);

            Assert.Equal(2, left.Get());

            binding.Dispose();

            left.Set(3);

            Assert.Equal(2, right.Get());
        }
Esempio n. 9
0
        public void Binding()
        {
            IDisposable binding = new ValueBinding<int>(left, right);

            left.Set(1);

            Assert.Equal(1, right.Get());

            right.Set(2);

            Assert.Equal(2, left.Get());

            binding.Dispose();

            left.Set(3);

            Assert.Equal(2, right.Get());
        }
Esempio n. 10
0
 public override void setValueBinding(string name, ValueBinding binding)
 {
     throw new NotSupportedException();
 }
Esempio n. 11
0
		public override void setValueBinding (string name, ValueBinding binding) {
			throw new NotSupportedException ();
		}
        /// <summary>
        /// Find a binding nested in the tree of property bidnings.
        /// </summary>
        public IBinding FindNestedBinding(string bindingName)
        {
            Argument.StringNotNullOrEmpty(() => bindingName);

            return(ValueBinding.FindNestedBinding(bindingName));
        }