/// <summary> /// Sets the slider position to the indicated value. The 'units' parameter /// is used to normalize the value for the number of ticks in the track bar /// </summary> /// <param name="sliderWidget">the slider widget</param> /// <param name="sliderPosition">slider value</param> /// <param name="units">conversion units</param> public static void SetState(this SliderWidget sliderWidget, int sliderPosition, decimal units) { if (sliderWidget != null) { sliderWidget.SetSliderValue(sliderPosition, 1 / units); } }
/// <summary> /// Returns the current value of the slider /// </summary> /// <param name="sliderWidget">The slider widget</param> /// <param name="units">conversion units</param> /// <returns>slider value</returns> public static int GetState(this SliderWidget sliderWidget, decimal units) { if (sliderWidget != null) { decimal unconvertedValue = sliderWidget.GetSliderValue(); return(Convert.ToInt32(unconvertedValue / units)); } return(0); }