private void StopButton_Click(object sender, EventArgs e)
 {
     InitPlayer();
     _player.Stop();
     SetDuration(new Rational(-1));
     UpdateTime(new Rational(0), false);
     LevelMeter.LevelChanged(null);
     DisplayDefaultCover();
 }
Beispiel #2
0
        private void UpdateTime(Rational overrideValue, bool timed)
        {
            if (_player == null)
            {
                TimeLabel.Text     = Utility.AbsoluteFormatTime(-1);
                DurationLabel.Text = Utility.AbsoluteFormatTime(-1);
                return;
            }
            Rational time;

            float[] levels;
            _player.GetCurrentTime(out time, out levels);
            time = overrideValue < 0 ? time : overrideValue;
            if (timed)
            {
                TimeLabel.Text = Utility.AbsoluteFormatTime(time.ToDouble(), HighPrecisionTime);
            }
            if (levels != null)
            {
                LevelMeter.LevelChanged(levels);
            }

            var position = (time * 100).ToIntTruncate();
            var duration = (_currentDuration * 100).ToIntTruncate();

            if (!DraggingSeekbar)
            {
                if (position < 0)
                {
                    SeekBar.Value = 0;
                }
                else if (position <= duration)
                {
                    SeekBar.Value = position;
                }
            }
        }