Example #1
0
        private void OnTouchEffectAction(object sender, SKTouchEventArgs args)
        {
            SliderControl theView = (SliderControl)sender;
            double        x       = args.Location.X;

            switch (args.ActionType)
            {
            case SKTouchAction.Pressed:
                _isPressed = true;
                break;

            case SKTouchAction.Moved:
                if (_isPressed)
                {
                    Value = (Maximum - Minimum) * x / theView.Width + Minimum;
                    InvalidateSurface();
                }
                break;

            case SKTouchAction.Released:
                if (_isPressed)
                {
                    if (ValueChangedCommand != null && ValueChangedCommand.CanExecute(Value))
                    {
                        ValueChangedCommand.Execute(Value);
                    }
                }
                _isPressed = false;
                break;

            case SKTouchAction.Cancelled:
                _isPressed = false;
                break;
            }
        }
        protected override void OnThumbDragCompleted(DragCompletedEventArgs e)
        {
            base.OnThumbDragCompleted(e);
            _isDragCompleted = true;

            if (ValueChangedCommand != null)
            {
                ValueChangedCommand.Execute((int)Value);
            }

            CurrTime = (int)Value;
        }
Example #3
0
 /// <summary>
 /// Slider Manipulation Completed
 /// </summary>
 /// <param name="sender">Slider</param>
 /// <param name="e">Manipulation Starting Routed Event Args</param>
 private void BindableSlider_ManipulationCompleted(object sender,
                                                   ManipulationCompletedRoutedEventArgs e)
 {
     if (_isStarted)
     {
         var slider = (Slider)sender;
         var value  = (int)slider.Value;
         if (ValueChangedCommand != null)
         {
             ValueChangedCommand.Execute(value);
         }
     }
     _isStarted = false;
 }
Example #4
0
        private void OnValueChanged(int currentValue)
        {
            decimal onePercentInValue = this.MaxValue / 100m;
            decimal percentInValue    = onePercentInValue * currentValue;

            if (percentInValue >= this.MaxValue)
            {
                percentInValue = this.MaxValue;
            }
            else if (percentInValue <= this.MinValue)
            {
                percentInValue = this.MinValue;
            }

            this.CurrentValue = (int)percentInValue;

            this.ValueChanged?.Invoke(this, new EventArgsSliderValueChanged()
            {
                CurrentValue = this.CurrentValue
            });
            ValueChangedCommand?.Execute(CurrentValue);
        }
Example #5
0
 private void OnValueChanged()
 {
     this.ValueChanged?.Invoke(this, EventArgs.Empty);
     ValueChangedCommand?.Execute(CurrentValue);
 }