Improvement on seek time slider
This commit is contained in:
parent
0aa80ed8b5
commit
86a652c170
@ -37,7 +37,7 @@
|
|||||||
<Grid HorizontalAlignment="Center" VerticalAlignment="Top">
|
<Grid HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock x:Name="CurrentTime" Text="0:00" TextWrapping="Wrap" HorizontalAlignment="Left"/>
|
<TextBlock x:Name="CurrentTime" Text="0:00" TextWrapping="Wrap" HorizontalAlignment="Left"/>
|
||||||
<Slider Style="{DynamicResource SliderTime}" x:Name="TimeSlider" MinWidth="320" Margin="5,0,5,0" HorizontalAlignment="Center" Maximum="100" PreviewMouseUp="TimeSlider_DragCompleted" FocusVisualStyle="{x:Null}"/>
|
<Slider Style="{DynamicResource SliderTime}" x:Name="TimeSlider" MinWidth="320" Margin="5,0,5,0" HorizontalAlignment="Center" Maximum="100" PreviewMouseUp="TimeSlider_DragCompleted" Thumb.DragStarted="TimeSlider_DragStarted" FocusVisualStyle="{x:Null}"/>
|
||||||
<TextBlock x:Name="EndTime" Text="0:00" TextWrapping="Wrap" Height="18" HorizontalAlignment="Right"/>
|
<TextBlock x:Name="EndTime" Text="0:00" TextWrapping="Wrap" Height="18" HorizontalAlignment="Right"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -5,6 +5,7 @@ using System.Windows.Controls;
|
|||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Controls.Primitives;
|
||||||
|
|
||||||
namespace unison
|
namespace unison
|
||||||
{
|
{
|
||||||
@ -14,6 +15,8 @@ namespace unison
|
|||||||
|
|
||||||
private readonly MPDHandler mpd;
|
private readonly MPDHandler mpd;
|
||||||
|
|
||||||
|
DispatcherTimer timer = new DispatcherTimer();
|
||||||
|
|
||||||
Thickness SelectedThickness;
|
Thickness SelectedThickness;
|
||||||
Thickness BaseThickness;
|
Thickness BaseThickness;
|
||||||
|
|
||||||
@ -26,7 +29,7 @@ namespace unison
|
|||||||
|
|
||||||
mpd = (MPDHandler)Application.Current.Properties["mpd"];
|
mpd = (MPDHandler)Application.Current.Properties["mpd"];
|
||||||
|
|
||||||
DispatcherTimer timer = new DispatcherTimer();
|
timer = new DispatcherTimer();
|
||||||
timer.Interval = TimeSpan.FromSeconds(0.5);
|
timer.Interval = TimeSpan.FromSeconds(0.5);
|
||||||
timer.Tick += Timer_Tick;
|
timer.Tick += Timer_Tick;
|
||||||
timer.Start();
|
timer.Start();
|
||||||
@ -174,6 +177,11 @@ namespace unison
|
|||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TimeSlider_DragStarted(object sender, DragStartedEventArgs e)
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
}
|
||||||
|
|
||||||
private void TimeSlider_DragCompleted(object sender, MouseButtonEventArgs e)
|
private void TimeSlider_DragCompleted(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
Slider slider = (Slider)sender;
|
Slider slider = (Slider)sender;
|
||||||
@ -183,6 +191,7 @@ namespace unison
|
|||||||
double SeekTime = SongPercentage / 100 * SongTime;
|
double SeekTime = SongPercentage / 100 * SongTime;
|
||||||
|
|
||||||
mpd.SetTime(SeekTime);
|
mpd.SetTime(SeekTime);
|
||||||
|
timer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void VolumeSlider_DragCompleted(object sender, MouseButtonEventArgs e)
|
private void VolumeSlider_DragCompleted(object sender, MouseButtonEventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user