private void ButtonSpinner_Spin(object sender, SpinEventArgs e)
        {
            ButtonSpinner spinner = (ButtonSpinner)sender;
            TextBox txtBox = (TextBox)spinner.Content;

            int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text);
            if (e.Direction == SpinDirection.Increase)
                value++;
            else
                value--;
            txtBox.Text = value.ToString();
        }
Example #2
0
        /// <summary>
        /// Raises the OnSpin event when spinning is initiated by the end-user.
        /// </summary>
        /// <param name="pEventArgs">The event arguments.</param>
        protected virtual void NotifySpin(SpinEventArgs pEventArgs)
        {
            ValidSpinDirections lDirection = pEventArgs.Direction == SpinDirection.Increase ? ValidSpinDirections.Increase : ValidSpinDirections.Decrease;

            // Only raise the event if spin is allowed.
            if ((this.ValidSpinDirections & lDirection) == lDirection)
            {
                if (this.Spin != null)
                {
                    this.Spin(this, pEventArgs);
                }
            }
        }
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;

            //Only raise the event if spin is allowed.
            if ((ValidSpinDirection & valid) == valid)
            {
                EventHandler<SpinEventArgs> handler = Spin;
                if (handler != null)
                {
                    handler(this, e);
                }
            }
        }
        private void OnSpinnerSpin(object sender, SpinEventArgs e)
        {
            if (AllowSpin && !IsReadOnly)
            {
                var  activeTrigger = this.MouseWheelActiveTrigger;
                bool spin          = !e.UsingMouseWheel;
                spin |= (activeTrigger == MouseWheelActiveTrigger.MouseOver);
                spin |= (TextBox.IsFocused && (activeTrigger == MouseWheelActiveTrigger.FocusedMouseOver));
                spin |= (TextBox.IsFocused && (activeTrigger == MouseWheelActiveTrigger.Focused) && (Mouse.Captured != null));

                if (spin)
                {
                    OnSpin(e);
                }
            }
        }
        protected virtual void OnSpin(SpinEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException("e");
            }

            if (e.Direction == SpinDirection.Increase)
            {
                DoIncrement();
            }
            else
            {
                DoDecrement();
            }
        }
Example #6
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("Spin action is not valid at this moment.");
            }

            EventHandler<SpinEventArgs> handler = Spin;
            if (handler != null)
            {
                handler(this, e);
            }
        }
Example #7
0
    protected virtual void OnSpin( SpinEventArgs e )
    {
      if( e == null )
        throw new ArgumentNullException( "e" );

      // Raise the Spinned event to user
      EventHandler<SpinEventArgs> handler = this.Spinned;
      if( handler != null )
      {
        handler( this, e );
      }

      if( e.Direction == SpinDirection.Increase )
        DoIncrement();
      else
        DoDecrement();
    }
Example #8
0
        private void Spinner_OnSpin(object sender, SpinEventArgs e)
        {
            var spinner = (ButtonSpinner)sender;
            var content = spinner.Content as string;

            int.TryParse(content ?? "0", out var value);
            if (e.Direction == SpinDirection.Increase)
            {
                value++;
            }
            else
            {
                value--;
            }

            spinner.Content = value.ToString();
        }
        private void ButtonSpinner_Spin(object sender, SpinEventArgs e)
        {
            ButtonSpinner spinner = (ButtonSpinner)sender;
            TextBox       txtBox  = (TextBox)spinner.Content;

            int value = String.IsNullOrEmpty(txtBox.Text) ? 0 : Convert.ToInt32(txtBox.Text);

            if (e.Direction == SpinDirection.Increase)
            {
                value++;
            }
            else
            if (value > 0)
            {
                value--;
            }
            txtBox.Text = value.ToString();
        }
        private void OnSpinnerSpin(object sender, SpinEventArgs e)
        {
            int oldValue = number;

            if (e.Direction == SpinDirection.Increase)
            {
                number = Math.Min(maximum, number + increment);
            }
            else if (e.Direction == SpinDirection.Decrease)
            {
                number = Math.Max(minimum, number - increment);
            }
            if (number != oldValue)
            {
                UpdateSpinner();
                UpdateTextBox();
                textBox.CaretIndex = textBox.Text.Length;
                RaiseEvent(new RoutedEventArgs(NumericUpDown.ValueChangedEvent));
            }
        }
Example #11
0
        /// <summary>
        /// Raises the OnSpin event when spinning is initiated by the end-user.
        /// </summary>
        /// <param name="e">The event args.</param>
        protected virtual void OnSpin(SpinEventArgs e)
        {
            if (e == null)
            {
                throw new ArgumentNullException(nameof(e));
            }

            var handler = Spinned;

            handler?.Invoke(this, e);

            if (e.Direction == SpinDirection.Increase)
            {
                DoIncrement();
            }
            else
            {
                DoDecrement();
            }
        }
    private void ButtonSpinner_Spin( object sender, SpinEventArgs e )
    {
      String[] names = (String[])this.Resources[ "names" ];

      ButtonSpinner spinner = ( ButtonSpinner )sender;
      TextBox txtBox = ( TextBox )spinner.Content;

      int value = Array.IndexOf( names, txtBox.Text );
      if( e.Direction == SpinDirection.Increase )
        value++;
      else
        value--;

      if( value < 0 )
        value = names.Length - 1;
      else if( value >= names.Length )
        value = 0;

      txtBox.Text = names[ value ];
    }
    private void ButtonSpinner_Spin( object sender, SpinEventArgs e )
    {
      String[] names = (String[])this.Resources[ "names" ];

      ButtonSpinner spinner = ( ButtonSpinner )sender;
      TextBox txtBox = ( TextBox )spinner.Content;

      int value = Array.IndexOf( names, txtBox.Text );
      if( e.Direction == SpinDirection.Increase )
        value++;
      else
        value--;

      if( value < 0 )
        value = names.Length - 1;
      else if( value >= names.Length )
        value = 0;

      txtBox.Text = names[ value ];
    }
Example #14
0
        private void ButtonMaxCountPoint_Spin(object sender, SpinEventArgs e)
        {
            string currentSpinValue = (string)ButtonMaxCountPoint.Content;

            int currentValue = String.IsNullOrEmpty(currentSpinValue) ? 0 : Convert.ToInt32(currentSpinValue);

            if (e.Direction == SpinDirection.Increase)
            {
                currentValue++;
                peremennye._maxCountPoint   = currentValue;
                ButtonMaxCountPoint.Content = currentValue.ToString();
            }
            else
            {
                currentValue--;
                if (currentValue < 1)
                {
                    currentValue = 1;
                }
                peremennye._maxCountPoint   = currentValue;
                ButtonMaxCountPoint.Content = currentValue.ToString();
            }
        }
Example #15
0
 private void comboBoxEdit1_Spin(object sender, SpinEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("Spin");
 }
Example #16
0
 private void _spinner_Spin(object sender, SpinEventArgs e)
 {
     var spinner = (ButtonSpinner)sender;
     var textBlock = (TextBlock)spinner.Content;
     textBlock.Text = (textBlock.Text == "AM") ? "PM" : "AM";
 }
 /// <summary>
 /// Occurs when the spinner spins.
 /// </summary>
 /// <param name="e">Event args.</param>
 protected override void OnSpin(SpinEventArgs e)
 {
     SpinActions.DoPreTest(e);
     base.OnSpin(e);
     SpinActions.DoTest(e);
 }
Example #18
0
 void btnAmtEdit_Spin(object sender, SpinEventArgs e)
 {
     e.Handled = true;
 }
Example #19
0
 private void textEdit2_Spin(object sender, SpinEventArgs e)
 {
     e.Handled = true;
 }
Example #20
0
 public virtual void OnSpin(SpinEventArgs e)
 {
     var handler = Spin;
     if (handler != null)
         handler(this, e);
 }
Example #21
0
 protected override void OnSpin(SpinEventArgs e)
 {
     e.Handled = true;
 }
Example #22
0
 private void buttonEdit_Properties_Spin(object sender, SpinEventArgs e)
 {
     MoveBy(e.IsSpinUp ? +1 : -1);
     e.Handled = true;
 }
Example #23
0
 private void OnCounterclockwiseSpin(object sender, SpinEventArgs e)
 {
     //do something here...
 }
Example #24
0
        public void OnSpin(SpinEventArgs e)
        {
            if (e == null)
                throw new ArgumentNullException("e");

            if (e.Direction == SpinDirection.Increase)
                DoIncrement();
            else
                DoDecrement();
        }
Example #25
0
 private void OnSpinnerSpin(object sender, SpinEventArgs e)
 {
     if (AllowSpin && !IsReadOnly)
         OnSpin(e);
 }
Example #26
0
 private void SpinEdit_Spin(object sender, SpinEventArgs e) {
     mouseDownTime = 0;
 }
Example #27
0
 private void SpinEdit_Spin(object sender, SpinEventArgs e)
 {
     _mouseDownTime = 0;
 }
        private void WidthSpinner_Spin(object sender, SpinEventArgs e)
        {
            ButtonSpinner spinner = (ButtonSpinner)sender;
            TextBox txtBox = (TextBox)spinner.Content;

            try
            {
                if (e.Direction == SpinDirection.Increase)
                    MapWidth += 0.1;
                else
                    MapWidth -= 0.1;
                txtBox.Text = String.Format("{0:N1}", MapWidth);
            }

            catch (FormatException)
            {
                txtBox.Text = String.Format("{0:N1}", MapWidth);
            }
        }
 private void OnMinutesSpin(object sender, SpinEventArgs e)
 {
     this.Minutes += e.Direction == SpinDirection.Increase ? 1 : -1;
 }
 protected internal void Spin(object sender, SpinEventArgs e)
 {
     e.Handled = (sender as DateEdit).IsEnabled;
 }
 /// <summary>
 /// Occurs when the spinner spins.
 /// </summary>
 /// <param name="e">Event args.</param>
 protected override void OnSpin(SpinEventArgs e)
 {
     SpinActions.DoPreTest(e);
     base.OnSpin(e);
     SpinActions.DoTest(e);
 }
 private void  едакторЧислаДинамическойТаблицы_Spin(object sender, SpinEventArgs e)
 {
     e.Handled = true;
 }
 private void buttonEdit_Properties_Spin(object sender, SpinEventArgs e)
 {
     MoveBy(e.IsSpinUp ? +1 : -1);
     e.Handled = true;
 }
        private void TableBlockSpinnerWide_Spin(object sender, SpinEventArgs e)
        {
            if (!(drawingCanvas.SelectedObject is GraphicsTableBlock))
                return;

            ButtonSpinner spinner = (ButtonSpinner)sender;
            TextBox txtBox = (TextBox)spinner.Content;
            GraphicsTableBlock selected = (drawingCanvas.SelectedObject as GraphicsTableBlock);

            if (e.Direction == SpinDirection.Increase)
                selected.NumTablesWide++;
            else
                selected.NumTablesWide--;
            txtBox.Text = selected.NumTablesWide.ToString();
        }
 private void OnSecondsSpin(object sender, SpinEventArgs e)
 {
     this.Seconds += e.Direction == SpinDirection.Increase ? 1 : -1;
 }