示例#1
0
        private void OnReleaseSongPosition(object sender, MouseButtonEventArgs e)
        {
            SongProgressBar.ReleaseMouseCapture();
            IsMouseCapture = false;

            ViewModel.PlayAtPercentage(SongProgressBar.Value);
        }
示例#2
0
        private void OnCaptureSongPosition(object sender, MouseButtonEventArgs e)
        {
            SongProgressBar.CaptureMouse();
            IsMouseCapture = true;

            // user maybe click and release so update event will not be fired
            OnUpdateSongPosition(sender, e);
        }
示例#3
0
 private void OnUpdateSongPosition(object sender, MouseEventArgs e)
 {
     if (IsMouseCapture && e.LeftButton == MouseButtonState.Pressed)
     {
         Point  mouse       = e.GetPosition(this);
         Point  progressbar = SongProgressBar.TransformToAncestor(this).Transform(new Point(0, 0));
         double percent     = (mouse.X - progressbar.X) / SongProgressBar.ActualWidth * 100.0;
         SongProgressBar.Value = percent;
     }
 }