protected override void Update(FrameEventArgs args) { base.Update(args); if (!_owner.Instrument.IsMidiOpen) { PlaybackSlider.MaxValue = 1; PlaybackSlider.SetValueWithoutEvent(0); return; } if (PlaybackSlider.Grabbed) { return; } PlaybackSlider.MaxValue = _owner.Instrument.PlayerTotalTick; PlaybackSlider.SetValueWithoutEvent(_owner.Instrument.PlayerTick); }
/// <summary> /// Ons the element changed. /// </summary> /// <param name="e">E.</param> protected override void OnElementChanged(ElementChangedEventArgs <Slider> e) { base.OnElementChanged(e); if (e.OldElement != null || e.NewElement == null) { return; } _slider = (PlaybackSlider)Element; Control.ThumbTintColor = _slider.ThumbColor.ToUIColor(); Control.MinimumTrackTintColor = _slider.ElapsedColor.ToUIColor(); Control.MaximumTrackTintColor = _slider.RemainingColor.ToUIColor(); Control.SetThumbImage(CreateThumb(), UIControlState.Normal); Control.TouchDown += OnPlaybackSliderTouchDown; Control.TouchUpInside += OnPlaybackSliderTouchUp; }
protected override void OnElementChanged(ElementChangedEventArgs <Slider> e) { base.OnElementChanged(e); if (e.OldElement != null || e.NewElement == null) { return; } _slider = (PlaybackSlider)Element; Control.Thumb.SetColorFilter(Xamarin.Forms.Color.FromHex("#AAAAAA").ToAndroid(), PorterDuff.Mode.SrcIn); Control.ProgressTintList = ColorStateList.ValueOf(_slider.ElapsedColor.ToAndroid()); Control.ProgressTintMode = PorterDuff.Mode.SrcIn; Control.ProgressBackgroundTintList = ColorStateList.ValueOf(_slider.RemainingColor.ToAndroid()); Control.ProgressBackgroundTintMode = PorterDuff.Mode.SrcIn; Control.StartTrackingTouch += OnPlaybackSliderTouchDown; Control.StopTrackingTouch += OnPlaybackSliderTouchUp; }