Exemplo n.º 1
0
        /// <summary>
        /// Change the indicator state to the given IndicatorLevel with a smooth animation.
        /// </summary>
        private void changeIndicatorLevel(IndicatorLevel newLevel)
        {
            switch (newLevel)
            {
            case IndicatorLevel.Low:
                this.LowIndicator.BeginAnimation(OpacityProperty, onAnimation);
                this.MiddleIndicator.BeginAnimation(OpacityProperty, offAnimation);
                this.HighIndicator.BeginAnimation(OpacityProperty, offAnimation);
                moveAnimation.To = -this.oneThirdOfActualWidth;
                break;

            case IndicatorLevel.Middle:
                this.LowIndicator.BeginAnimation(OpacityProperty, offAnimation);
                this.MiddleIndicator.BeginAnimation(OpacityProperty, onAnimation);
                this.HighIndicator.BeginAnimation(OpacityProperty, offAnimation);
                moveAnimation.To = 0;
                break;

            case IndicatorLevel.High:
                this.LowIndicator.BeginAnimation(OpacityProperty, offAnimation);
                this.MiddleIndicator.BeginAnimation(OpacityProperty, offAnimation);
                onAnimation.To = 1.0;
                this.HighIndicator.BeginAnimation(OpacityProperty, onAnimation);
                onAnimation.To   = 0.9;
                moveAnimation.To = this.oneThirdOfActualWidth;
                break;

            default:
                throw new ArgumentOutOfRangeException("newLevel");
            }

            this.IndicatorTranslateTransform.BeginAnimation(TranslateTransform.XProperty, moveAnimation);
        }
Exemplo n.º 2
0
        private void OnIndicatorStateChanged(IndicatorLevel oldValue, IndicatorLevel newValue)
        {
            if (oldValue.Equals(newValue))
            {
                return;
            }

            this.changeIndicatorLevel(newValue);
        }