コード例 #1
0
        public void SetMediaPlayerSongPositionTest()
        {
            var playControlViewModel = new PlayControlViewModel();

            playControlViewModel.mediaPlayer.Open(new Uri(path));
            Thread.Sleep(200);
            playControlViewModel.SliderDurationValue = 0;
            playControlViewModel.SetMediaPlayerSongPosition();
            Assert.AreEqual(0, playControlViewModel.GetActualSongSecond());
            playControlViewModel.SliderDurationValue = 2;
            playControlViewModel.SetMediaPlayerSongPosition();
            Assert.AreEqual(5, playControlViewModel.GetActualSongSecond());
        }
コード例 #2
0
 private void timeSlider_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 {
     if (playControlViewModel.GetSongSecondsCount() > 0)
     {
         Slider slider = sender as Slider;
         playControlViewModel.SetMediaPlayerSongPosition();
         ControlExtensions.InvokeIfRequired(this, (x) =>
         {
             durationSlider.Value = x;
             sliderNewValue       = playControlViewModel.CalculateSliderValue();
         }, sliderNewValue);
         playControlViewModel.PlayOrPauseSong();
     }
 }