Exemplo n.º 1
0
 public void SecondsAndHours()
 {
     Assert.Equal(ControlBarHelper.IntToTimeString(3601), "1:00:01");
     Assert.Equal(ControlBarHelper.IntToTimeString(3659), "1:00:59");
     Assert.Equal(ControlBarHelper.IntToTimeString(36001), "10:00:01");
     Assert.Equal(ControlBarHelper.IntToTimeString(36059), "10:00:59");
 }
        /// <summary>
        /// USed to update the scrollbar progress as the video is playing
        /// </summary>
        /// <param name="sender">The parent thread</param>
        /// <param name="e">arguments</param>
        private void VideoProgressThread_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            while (!VideoProgressThread.CancellationPending)
            {
                int currentTime = 0; int totalTime = 0;
                if (videoState && !VideoProgressThread.CancellationPending)
                {
                    Dispatcher.Invoke(() =>
                    {
                        if (VideoProgressThread.CancellationPending)
                        {
                            return;
                        }
                        currentTime = (int)mediaElement.Position.TotalSeconds;
                        totalTime   = (int)mediaElement.NaturalDuration.TimeSpan.TotalSeconds;
                    });
                }
                string timeString = ControlBarHelper.IntToTimeString(currentTime) + "/" + ControlBarHelper.IntToTimeString(totalTime);
                if (videoState && !VideoProgressThread.CancellationPending)
                {
                    Dispatcher.Invoke(() =>
                    {
                        VideoTime.Content  = timeString;
                        playerSlider.Value = mediaElement.Position.TotalSeconds;
                        graphSlider.Value  = mediaElement.Position.TotalSeconds;
                    });
                }

                Thread.Sleep(PROGRESS_BAR_UPDATE_SPEED);
            }
            e.Cancel = true;
            return;
        }
Exemplo n.º 3
0
 public void MinutesAndHours()
 {
     Assert.Equal(ControlBarHelper.IntToTimeString(3660), "1:01:00");
     Assert.Equal(ControlBarHelper.IntToTimeString(7140), "1:59:00");
     Assert.Equal(ControlBarHelper.IntToTimeString(36060), "10:01:00");
     Assert.Equal(ControlBarHelper.IntToTimeString(39540), "10:59:00");
 }
Exemplo n.º 4
0
 public void Minutes()
 {
     Assert.Equal(ControlBarHelper.IntToTimeString(60), "01:00");
     Assert.Equal(ControlBarHelper.IntToTimeString(600), "10:00");
     Assert.Equal(ControlBarHelper.IntToTimeString(660), "11:00");
     Assert.Equal(ControlBarHelper.IntToTimeString(3540), "59:00");
 }
Exemplo n.º 5
0
 public void Hours()
 {
     Assert.Equal(ControlBarHelper.IntToTimeString(3600), "1:00:00");
     Assert.Equal(ControlBarHelper.IntToTimeString(36000), "10:00:00");
     Assert.Equal(ControlBarHelper.IntToTimeString(39600), "11:00:00");
     Assert.Equal(ControlBarHelper.IntToTimeString(360000), "100:00:00");
     Assert.Equal(ControlBarHelper.IntToTimeString(18000), "5:00:00");
 }
Exemplo n.º 6
0
 public void SecondsAndMinutes()
 {
     Assert.Equal(ControlBarHelper.IntToTimeString(61), "01:01");
     Assert.Equal(ControlBarHelper.IntToTimeString(70), "01:10");
     Assert.Equal(ControlBarHelper.IntToTimeString(119), "01:59");
     Assert.Equal(ControlBarHelper.IntToTimeString(610), "10:10");
     Assert.Equal(ControlBarHelper.IntToTimeString(671), "11:11");
     Assert.Equal(ControlBarHelper.IntToTimeString(3599), "59:59");
 }
Exemplo n.º 7
0
 public async Task PlayTest()
 {
     await StartSTATask(() =>
     {
         Image i = new Image();
         ControlBarHelper.SetPausePlayImage(false, i);
         Assert.Equal(new Uri(@"/CapstoneLayoutTest;component/Images/ic_play_arrow_white_24dp.png", UriKind.Relative), (i.Source as BitmapImage).UriSource);
     });
 }
        /// <summary>
        /// Plays or pauses the video depending on the current video state
        /// </summary>
        private void PausePlay()
        {
            switch (videoState)
            {
            case true:
                mediaElement.Pause();
                ControlBarHelper.SetPausePlayImage(false, pausePlayImage);
                videoState = false;
                break;

            case false:
                mediaElement.Play();
                ControlBarHelper.SetPausePlayImage(true, pausePlayImage);
                videoState = true;
                break;
            }
        }
Exemplo n.º 9
0
 public void SecondsAndMinutesAndHours()
 {
     Assert.Equal(ControlBarHelper.IntToTimeString(3661), "1:01:01");
     Assert.Equal(ControlBarHelper.IntToTimeString(40271), "11:11:11");
     Assert.Equal(ControlBarHelper.IntToTimeString(21355), "5:55:55");
 }
Exemplo n.º 10
0
 public void Seconds()
 {
     Assert.Equal(ControlBarHelper.IntToTimeString(1), "00:01");
     Assert.Equal(ControlBarHelper.IntToTimeString(10), "00:10");
     Assert.Equal(ControlBarHelper.IntToTimeString(59), "00:59");
 }
Exemplo n.º 11
0
 public void NoTime()
 {
     Assert.Equal(ControlBarHelper.IntToTimeString(0), "00:00");
 }