Skip to content

Commit

Permalink
Fix time in Media Controls not updating
Browse files Browse the repository at this point in the history
  • Loading branch information
sabihoshi committed May 17, 2021
1 parent 20cd8c8 commit 2ce3c2a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion GenshinLyreMidiPlayer.WPF/GenshinLyreMidiPlayer.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<UseWPF>true</UseWPF>
<StartupObject>GenshinLyreMidiPlayer.WPF.App</StartupObject>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Version>1.10.3</Version>
<Version>1.10.4</Version>
<ApplicationIcon>item_windsong_lyre.ico</ApplicationIcon>
<Nullable>enable</Nullable>
<RepositoryUrl>https://github.com/sabihoshi/GenshinLyreMidiPlayer</RepositoryUrl>
Expand Down
8 changes: 4 additions & 4 deletions GenshinLyreMidiPlayer.WPF/ViewModels/LyrePlayerViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public bool CanHitPlayPause
}
}

public bool CanHitPrevious => _songPosition > TimeSpan.FromSeconds(3) || Playlist.History.Count > 1;
public bool CanHitPrevious => CurrentTime > TimeSpan.FromSeconds(3) || Playlist.History.Count > 1;

public double SongPosition
{
Expand Down Expand Up @@ -163,7 +163,7 @@ public void OnSongPositionChanged()
if (!_ignoreSliderChange && Playback is { IsRunning: true })
{
Playback.Stop();
Playback.MoveToTime(new MetricTimeSpan(_songPosition));
Playback.MoveToTime(new MetricTimeSpan(CurrentTime));

if (Settings.UseSpeakers)
Playback.Start();
Expand Down Expand Up @@ -213,7 +213,7 @@ public void UpdateButtons()
var position = $"{file.Position}/{Playlist.GetPlaylist().Count}";

Display.Title = file.Title;
Display.Artist = $"Playing {position} {SongPosition:mm\\:ss}";
Display.Artist = $"Playing {position} {CurrentTime:mm\\:ss}";
}

Controls.DisplayUpdater.Update();
Expand Down Expand Up @@ -336,7 +336,7 @@ private int ApplyNoteSettings(int noteId)

public void Previous()
{
if (_songPosition > TimeSpan.FromSeconds(3))
if (CurrentTime > TimeSpan.FromSeconds(3))
{
Playback!.MoveToStart();
MoveSlider(TimeSpan.Zero);
Expand Down

0 comments on commit 2ce3c2a

Please sign in to comment.