diff --git a/Handlers/MPDHandler.cs b/Handlers/MPDHandler.cs
index 01f740f..87385b6 100644
--- a/Handlers/MPDHandler.cs
+++ b/Handlers/MPDHandler.cs
@@ -287,6 +287,12 @@ namespace unison
await _mpd.MpdSetVolume(value);
}
+ public async void SetTime(int value)
+ {
+ if (!IsBusy)
+ await _mpd.MpdPlaybackSeek(_mpd.MpdCurrentSong.Id, value);
+ }
+
public bool IsPlaying()
{
return _currentStatus?.MpdState == MPDCtrl.Models.Status.MpdPlayState.Play;
diff --git a/Views/MainWindow.xaml b/Views/MainWindow.xaml
index 18d5904..e90289b 100644
--- a/Views/MainWindow.xaml
+++ b/Views/MainWindow.xaml
@@ -33,48 +33,48 @@
-
+
-
-
+
-
+
-
+
-
+
-
+
@@ -99,7 +99,7 @@
-
+
@@ -113,7 +113,7 @@
-->
-
+
diff --git a/Views/MainWindow.xaml.cs b/Views/MainWindow.xaml.cs
index ad0d27b..e171ba3 100644
--- a/Views/MainWindow.xaml.cs
+++ b/Views/MainWindow.xaml.cs
@@ -4,6 +4,8 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;
using System.Windows.Interop;
+using System.Windows.Controls.Primitives;
+using System.Windows.Input;
namespace unison
{
@@ -150,6 +152,24 @@ namespace unison
Hide();
}
+ private void TimeSlider_DragCompleted(object sender, MouseButtonEventArgs e)
+ {
+ Slider slider = (Slider)sender;
+
+ double SongPercentage = slider.Value;
+ double SongTime = mpd.GetStatus().MpdSongTime;
+ double SeekTime = SongPercentage / 100 * SongTime;
+
+ mpd.SetTime((int)SeekTime);
+ }
+
+ private void VolumeSlider_DragCompleted(object sender, MouseButtonEventArgs e)
+ {
+ Slider slider = (Slider)sender;
+ mpd.SetVolume((int)slider.Value);
+ slider.ToolTip = mpd._currentVolume;
+ }
+
protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);