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();
        }
예제 #2
0
파일: ASpinner.cs 프로젝트: mastertnt/XRay
        /// <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);
                }
            }
        }
예제 #3
0
파일: Spinner.cs 프로젝트: ohnx/ColorPick
        /// <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();
            }
        }
예제 #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);
            }
        }
예제 #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();
    }
예제 #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));
            }
        }
예제 #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 ];
    }
예제 #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();
            }
        }
예제 #15
0
 private void comboBoxEdit1_Spin(object sender, SpinEventArgs e)
 {
     System.Diagnostics.Debug.WriteLine("Spin");
 }
예제 #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);
 }
예제 #18
0
 void btnAmtEdit_Spin(object sender, SpinEventArgs e)
 {
     e.Handled = true;
 }
예제 #19
0
 private void textEdit2_Spin(object sender, SpinEventArgs e)
 {
     e.Handled = true;
 }
예제 #20
0
 public virtual void OnSpin(SpinEventArgs e)
 {
     var handler = Spin;
     if (handler != null)
         handler(this, e);
 }
예제 #21
0
 protected override void OnSpin(SpinEventArgs e)
 {
     e.Handled = true;
 }
예제 #22
0
 private void buttonEdit_Properties_Spin(object sender, SpinEventArgs e)
 {
     MoveBy(e.IsSpinUp ? +1 : -1);
     e.Handled = true;
 }
예제 #23
0
 private void OnCounterclockwiseSpin(object sender, SpinEventArgs e)
 {
     //do something here...
 }
예제 #24
0
        public void OnSpin(SpinEventArgs e)
        {
            if (e == null)
                throw new ArgumentNullException("e");

            if (e.Direction == SpinDirection.Increase)
                DoIncrement();
            else
                DoDecrement();
        }
예제 #25
0
 private void OnSpinnerSpin(object sender, SpinEventArgs e)
 {
     if (AllowSpin && !IsReadOnly)
         OnSpin(e);
 }
예제 #26
0
 private void SpinEdit_Spin(object sender, SpinEventArgs e) {
     mouseDownTime = 0;
 }
예제 #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);
            }
        }
예제 #29
0
 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();
        }
예제 #35
0
 private void OnSecondsSpin(object sender, SpinEventArgs e)
 {
     this.Seconds += e.Direction == SpinDirection.Increase ? 1 : -1;
 }