標籤刷新更改方式

This commit is contained in:
jasonchenwork 2025-06-24 10:56:25 +08:00
parent 7eb8f395a0
commit 5db51dda99

View File

@ -450,13 +450,13 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
// 如果目前不在 UI 執行緒上,必須透過 Invoke 安全執行 UI 更新邏輯 // 如果目前不在 UI 執行緒上,必須透過 Invoke 安全執行 UI 更新邏輯
Console.WriteLine("SongDisplayTimer_Tick invoked on UI thread."); Console.WriteLine("SongDisplayTimer_Tick invoked on UI thread.");
MainForm.Invoke(new System.Action(() => MainForm.BeginInvoke(new Action(() =>
{ {
// 清除目前歌曲的顯示標籤文字 if (MainForm.songDisplayLabel != null)
MainForm.songDisplayLabel.Text = ""; MainForm.songDisplayLabel.Text = "";
// 顯示下一首歌的標籤 if (MainForm.nextSongLabel != null)
MainForm.nextSongLabel.Visible = true; MainForm.nextSongLabel.Visible = true;
})); }));
} }
else else