/// <summary>
 /// Display the interactive ButtonSpinner control's properties.
 /// </summary>
 /// <param name="e">The SpinEventArgs.</param>
 private void OnSpin(SpinEventArgs e)
 {
     string s = string.Format(CultureInfo.InvariantCulture, "SpinEventArgs.Direction: \t{0}", e.Direction);
     display.Items.Add(s);
     display.SelectedIndex = display.Items.Count - 1;
     Dispatcher.BeginInvoke(() => display.ScrollIntoView(s));
 }
        /// <summary>
        /// Occurs when the spinner spins.
        /// </summary>
        /// <param name="e">Event args.</param>
        protected virtual void OnSpin(SpinEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            if (e.Direction == SpinDirection.Increase)
            {
                DoIncrement();
            }
            else
            {
                DoDecrement();
            }
        }
Example #3
0
        /// <summary>
        /// Raises the OnSpin event when spinning is initiated by the end-user.
        /// </summary>
        /// <param name="e">Spin event args.</param>
        protected virtual void OnSpin(SpinEventArgs e)
        {
            ValidSpinDirections valid = e.Direction == SpinDirection.Increase ? ValidSpinDirections.Increase : ValidSpinDirections.Decrease;

            if ((ValidSpinDirection & valid) != valid)
            {
                // spin is not allowed.
                throw new InvalidOperationException(Properties.Resources.Spinner_SpinNotValid);
            }

            EventHandler <SpinEventArgs> handler = Spin;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Example #4
0
        /// <summary>
        /// Raises the OnSpin event when spinning is initiated by the end-user.
        /// </summary>
        /// <param name="e">Spin event args.</param>
        protected virtual void OnSpin(SpinEventArgs e)
        {
            ValidSpinDirections valid = e.Direction == SpinDirection.Increase ? ValidSpinDirections.Increase : ValidSpinDirections.Decrease;

            if ((ValidSpinDirection & valid) != valid)
            {
                // spin is not allowed.
                throw new InvalidOperationException(Properties.Resources.Spinner_SpinNotValid);
            }

            EventHandler<SpinEventArgs> handler = Spin;
            if (handler != null)
            {
                handler(this, e);
            }
        }