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); }
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); }
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); }
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); }
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); }
/// <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. }
/// <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)); }
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); }
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); }
/// <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. }
/// <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); }