From 2ce3c2a3f7219befa06ccace6a6869f7cae437b9 Mon Sep 17 00:00:00 2001 From: sabihoshi Date: Mon, 17 May 2021 23:21:24 +0800 Subject: [PATCH] Fix time in Media Controls not updating --- .../GenshinLyreMidiPlayer.WPF.csproj | 2 +- .../ViewModels/LyrePlayerViewModel.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/GenshinLyreMidiPlayer.WPF/GenshinLyreMidiPlayer.WPF.csproj b/GenshinLyreMidiPlayer.WPF/GenshinLyreMidiPlayer.WPF.csproj index 691a5cd..10be9c2 100644 --- a/GenshinLyreMidiPlayer.WPF/GenshinLyreMidiPlayer.WPF.csproj +++ b/GenshinLyreMidiPlayer.WPF/GenshinLyreMidiPlayer.WPF.csproj @@ -6,7 +6,7 @@ true GenshinLyreMidiPlayer.WPF.App app.manifest - 1.10.3 + 1.10.4 item_windsong_lyre.ico enable https://github.com/sabihoshi/GenshinLyreMidiPlayer diff --git a/GenshinLyreMidiPlayer.WPF/ViewModels/LyrePlayerViewModel.cs b/GenshinLyreMidiPlayer.WPF/ViewModels/LyrePlayerViewModel.cs index 72bd0ae..001f543 100644 --- a/GenshinLyreMidiPlayer.WPF/ViewModels/LyrePlayerViewModel.cs +++ b/GenshinLyreMidiPlayer.WPF/ViewModels/LyrePlayerViewModel.cs @@ -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 { @@ -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(); @@ -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(); @@ -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);