示例#1
0
        public void IntegerSliderMaxValue()
        {
            var integerSliderNode = new IntegerSlider() { Value = 500 };
            var updateValueParams = new UpdateValueParams("Value", "1000");
            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                 1000,
                 integerSliderNode.Max);

            updateValueParams = new UpdateValueParams("Value", "-1");
            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                 -1,
                 integerSliderNode.Min);

            updateValueParams = new UpdateValueParams("Value", "2147483648");
            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                2147483647,
                integerSliderNode.Max);

            updateValueParams = new UpdateValueParams("Value", "-2147483649");
            integerSliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                -2147483648,
                integerSliderNode.Min);
        }
示例#2
0
        public void SliderMaxValueWithBigNum()
        {
            var sliderNode = new DoubleSlider() { Value = 500 };
            var updateValueParams = new UpdateValueParams("Max", "2.14748364712346E+15");
            sliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                 2.14748364712346E+15,
                 sliderNode.Max);           
        }
示例#3
0
        protected override bool UpdateValueCore(UpdateValueParams updateValueParams)
        {
            string name = updateValueParams.PropertyName;
            string value = updateValueParams.PropertyValue;

            if (name == "FormulaString")
            {
                FormulaString = value;
                return true; // UpdateValueCore handled.
            }

            return base.UpdateValueCore(updateValueParams);
        }
示例#4
0
        protected override bool UpdateValueCore(UpdateValueParams updateValueParams)
        {
            string name = updateValueParams.PropertyName;
            string value = updateValueParams.PropertyValue;

            if (name == "Value")
            {
                Value = value; 
                return true; // UpdateValueCore handled.
            }

            // There's another 'UpdateValueCore' method in 'String' base class,
            // since they are both bound to the same property, 'StringInput' 
            // should be given a chance to handle the property value change first
            // before the base class 'String'.
            return base.UpdateValueCore(updateValueParams);
        }
示例#5
0
        public void SliderMaxValue()
        {
            var sliderNode = new DoubleSlider() { Value = 500 };
            var updateValueParams = new UpdateValueParams("Value", "1000");
            sliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                 1000,
                 sliderNode.Max);

            updateValueParams = new UpdateValueParams("Value", "-1");
            sliderNode.UpdateValue(updateValueParams);

            Assert.AreEqual(
                 -1,
                 sliderNode.Min);
        }
示例#6
0
 /// <summary>
 /// This method is supplied as a generic way for command framework to update
 /// a given named-value in a ModelBase (which has to work under both user
 /// and playback scenarios). During playback, the command framework issues
 /// pre-recorded UpdateModelValueCommand that targets a model. Since there
 /// is no data-binding at play here, there will not be IValueConverter. This
 /// method takes only string input (the way they appear in DynamoTextBox),
 /// which overridden method can use for value conversion.
 /// </summary>
 /// <param name="updateValueParams">Please see UpdateValueParams for details.</param>
 /// <returns>Returns true if the call has been handled, or false otherwise.
 /// </returns>
 protected virtual bool UpdateValueCore(UpdateValueParams updateValueParams)
 {
     return(false); // Base class does not handle this.
 }
示例#7
0
 /// <summary>
 /// Updates object properties.
 /// UpdateValueCore is overridden in derived classes.
 /// </summary>
 /// <param name="updateValueParams">Please see UpdateValueParams for details.</param>
 /// <returns>Returns true if the call has been handled, or false otherwise.</returns>
 public bool UpdateValue(UpdateValueParams updateValueParams)
 {
     return(UpdateValueCore(updateValueParams));
 }
示例#8
0
        protected override bool UpdateValueCore(UpdateValueParams updateValueParams)
        {
            switch (updateValueParams.PropertyName)
            {
                case "Values":
                    // Here we expect a string that represents an array of [ metric, from, to ] values which are separated by ";"
                    // For example "Length;Meters;Feet"
                    var vals = updateValueParams.PropertyValue.Split(';');
                    ConversionMetricUnit metric;
                    ConversionUnit from, to;
                    if (vals.Length == 3 && Enum.TryParse(vals[0], out metric)
                        && Enum.TryParse(vals[1], out from) && Enum.TryParse(vals[2], out to))
                    {
                        SelectedMetricConversion = metric;
                        SelectedFromConversion = from;
                        SelectedToConversion = to;
                    }

                    return true;
            }

            return base.UpdateValueCore(updateValueParams);
        }
示例#9
0
        protected override bool UpdateValueCore(UpdateValueParams updateValueParams)
        {
            string name = updateValueParams.PropertyName;
            string value = updateValueParams.PropertyValue;

            if (name == "ScriptContent")
            {
                script = value;
                return true;
            }

            return base.UpdateValueCore(updateValueParams);
        }
示例#10
0
 /// <summary>
 /// This method is supplied as a generic way for command framework to update
 /// a given named-value in a ModelBase (which has to work under both user
 /// and playback scenarios). During playback, the command framework issues
 /// pre-recorded UpdateModelValueCommand that targets a model. Since there
 /// is no data-binding at play here, there will not be IValueConverter. This
 /// method takes only string input (the way they appear in DynamoTextBox),
 /// which overridden method can use for value conversion.
 /// </summary>
 /// <param name="updateValueParams">Please see UpdateValueParams for details.</param>
 /// <returns>Returns true if the call has been handled, or false otherwise.
 /// </returns>
 protected virtual bool UpdateValueCore(UpdateValueParams updateValueParams)
 {
     return false; // Base class does not handle this.
 }
示例#11
0
 /// <summary>
 /// Updates object properties.
 /// UpdateValueCore is overridden in derived classes.
 /// </summary>
 /// <param name="updateValueParams">Please see UpdateValueParams for details.</param>
 /// <returns>Returns true if the call has been handled, or false otherwise.</returns>
 public bool UpdateValue(UpdateValueParams updateValueParams)
 {
     return UpdateValueCore(updateValueParams);
 }