Ejemplo n.º 1
0
        private void activityWorker_Tick(object sender, EventArgs e)
        {
            bool shouldHide = User32GetIdle.GetLastInput() > activityThreshold;

            if (isHidden != shouldHide)
            {
                if (shouldHide)
                {
                    this.Cursor              = Cursors.None;
                    btnPlay.Visibility       = Visibility.Hidden;
                    btnPause.Visibility      = Visibility.Hidden;
                    btnFullscreen.Visibility = Visibility.Hidden;
                    sliderSeek.Visibility    = Visibility.Hidden;
                    sliderVolume.Visibility  = Visibility.Hidden;
                }
                else
                {
                    this.Cursor              = Cursors.Arrow;
                    btnPlay.Visibility       = Visibility.Visible;
                    btnPause.Visibility      = Visibility.Visible;
                    btnFullscreen.Visibility = Visibility.Visible;
                    sliderSeek.Visibility    = Visibility.Visible;
                    sliderVolume.Visibility  = Visibility.Visible;
                }
                isHidden = shouldHide;
            }
        }
Ejemplo n.º 2
0
 private void sliderSeek_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     if (User32GetIdle.GetLastInput() <= TimeSpan.FromMilliseconds(500))
     {
         mediaElement1.Pause();
         timerTs.Stop();
         mediaElement1.Position = TimeSpan.FromSeconds(sliderSeek.Value);
         mediaElement1.Play();
         timerTs.Start();
     }
     if (sliderSeek.Value == sliderSeek.Maximum)
     {
         sliderSeek.Value       = 0;
         mediaElement1.Position = TimeSpan.FromTicks(0);
     }
     else
     {
         return;
     }
 }