遙控器相關問題修正
This commit is contained in:
parent
eb1db3c8c8
commit
2502ac41c5
@ -10,7 +10,7 @@ namespace DualScreenDemo
|
|||||||
public static bool readyForSongListInput = false;
|
public static bool readyForSongListInput = false;
|
||||||
/* 關機 queue */
|
/* 關機 queue */
|
||||||
private readonly int _maxHistoryLength = 6; // 最多保留 6 筆
|
private readonly int _maxHistoryLength = 6; // 最多保留 6 筆
|
||||||
private readonly Queue<string> _indataHistory = new Queue<string>();
|
public static readonly Queue<string> _indataHistory = new Queue<string>();
|
||||||
/* 顯示按鈕設定 */
|
/* 顯示按鈕設定 */
|
||||||
private int _wrongInputCountfor62 = 0; // 錯誤輸入計數器
|
private int _wrongInputCountfor62 = 0; // 錯誤輸入計數器
|
||||||
private int _wrongInputCountfor61 = 0; // 錯誤輸入計數器
|
private int _wrongInputCountfor61 = 0; // 錯誤輸入計數器
|
||||||
@ -28,7 +28,7 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
AddToHistory(indata);
|
AddToHistory(indata);
|
||||||
// 遙控器測試
|
// 遙控器測試
|
||||||
Console.WriteLine("遙控器:" + indata);
|
Console.WriteLine("遙控器: " + indata);
|
||||||
switch (indata)
|
switch (indata)
|
||||||
{
|
{
|
||||||
case "A261A4": // 輸入
|
case "A261A4": // 輸入
|
||||||
@ -301,7 +301,7 @@ namespace DualScreenDemo
|
|||||||
OverlayForm.displayTimer.Stop();
|
OverlayForm.displayTimer.Stop();
|
||||||
string input = "a";
|
string input = "a";
|
||||||
|
|
||||||
|
// 輸入歌曲
|
||||||
string songNumber = OverlayForm.ReadSongNumber();
|
string songNumber = OverlayForm.ReadSongNumber();
|
||||||
var song = songListManager.SearchSongByNumber(songNumber);
|
var song = songListManager.SearchSongByNumber(songNumber);
|
||||||
|
|
||||||
@ -558,7 +558,8 @@ namespace DualScreenDemo
|
|||||||
Console.WriteLine("ClearDisplay called.");
|
Console.WriteLine("ClearDisplay called.");
|
||||||
|
|
||||||
// 重設狀態標記與 UI 狀態
|
// 重設狀態標記與 UI 狀態
|
||||||
readyForSongListInput = false;
|
// 嘗試 true
|
||||||
|
readyForSongListInput = true;
|
||||||
OverlayForm.SetUIState(OverlayForm.UIState.Initial);
|
OverlayForm.SetUIState(OverlayForm.UIState.Initial);
|
||||||
Console.WriteLine("Display cleared.");
|
Console.WriteLine("Display cleared.");
|
||||||
}
|
}
|
||||||
|
@ -17,14 +17,14 @@ namespace DBObj
|
|||||||
{
|
{
|
||||||
if (category == "全部")
|
if (category == "全部")
|
||||||
{
|
{
|
||||||
string query = $"SELECT * FROM ArtistLibrary WHERE 歌手筆畫 >= {minStrokes} AND 歌手筆畫 <={maxStrokes}";
|
string query = $"SELECT * FROM artists WHERE strokes_abbr >= {minStrokes} AND strokes_abbr <={maxStrokes}";
|
||||||
var searchResults = PrimaryForm.SearchSingers_Mysql(query);
|
var searchResults = PrimaryForm.SearchSingers_Mysql(query);
|
||||||
return searchResults;
|
return searchResults;
|
||||||
//return AllArtists.Where(artist => artist.Strokes >= minStrokes && artist.Strokes <= maxStrokes).ToList();
|
//return AllArtists.Where(artist => artist.Strokes >= minStrokes && artist.Strokes <= maxStrokes).ToList();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string query = $"SELECT * FROM ArtistLibrary WHERE 歌手分類 = '{category}' AND 歌手筆畫 >= {minStrokes} AND 歌手筆畫 <={maxStrokes}";
|
string query = $"SELECT * FROM artists WHERE category = '{category}' AND strokes_abbr >= {minStrokes} AND strokes_abbr <={maxStrokes}";
|
||||||
var searchResults = PrimaryForm.SearchSingers_Mysql(query);
|
var searchResults = PrimaryForm.SearchSingers_Mysql(query);
|
||||||
return searchResults;
|
return searchResults;
|
||||||
//return AllArtists.Where(artist => artist.Category == category && artist.Strokes >= minStrokes && artist.Strokes <= maxStrokes).ToList();
|
//return AllArtists.Where(artist => artist.Category == category && artist.Strokes >= minStrokes && artist.Strokes <= maxStrokes).ToList();
|
||||||
|
@ -63,7 +63,7 @@ namespace DualScreenDemo
|
|||||||
string externalQrContent = !string.IsNullOrEmpty(externalAddress) ?
|
string externalQrContent = !string.IsNullOrEmpty(externalAddress) ?
|
||||||
String.Format("http://{0}:{1}/{2}/windows.html", externalAddress, externalPort, randomFolderName) :
|
String.Format("http://{0}:{1}/{2}/windows.html", externalAddress, externalPort, randomFolderName) :
|
||||||
localQrContent;
|
localQrContent;
|
||||||
|
|
||||||
GenerateQRCode(externalQrContent, Path.Combine(baseDirectory, randomFolderName, "qrcode.png"));
|
GenerateQRCode(externalQrContent, Path.Combine(baseDirectory, randomFolderName, "qrcode.png"));
|
||||||
|
|
||||||
_qrReadyTcs?.TrySetResult(randomFolderName); // safe call,null-safe
|
_qrReadyTcs?.TrySetResult(randomFolderName); // safe call,null-safe
|
||||||
|
@ -474,56 +474,48 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
|||||||
|
|
||||||
|
|
||||||
private readonly object _lockObject = new object();
|
private readonly object _lockObject = new object();
|
||||||
|
private bool _handlingTimeout = false;
|
||||||
private async void UnifiedTimer_Elapsed(object sender, EventArgs e)
|
private async void UnifiedTimer_Elapsed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// Console.WriteLine("UnifiedTimer_Elapsed called");
|
if (_handlingTimeout) return;
|
||||||
|
_handlingTimeout = true;
|
||||||
|
|
||||||
if (MainForm.InvokeRequired)
|
try
|
||||||
{
|
|
||||||
MainForm.Invoke(new System.Action<object, EventArgs>(UnifiedTimer_Elapsed), new object[] { sender, e });
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
displayLabel.Text = "";
|
|
||||||
|
|
||||||
switch (CurrentUIState)
|
|
||||||
{
|
{
|
||||||
case UIState.SelectingLanguage:
|
if (MainForm.InvokeRequired)
|
||||||
|
{
|
||||||
SetUIState(UIState.Initial);
|
MainForm.BeginInvoke((Action)(() => UnifiedTimer_Elapsed(sender, e)));
|
||||||
await HandleTimeout("");
|
return;
|
||||||
break;
|
}
|
||||||
case UIState.SelectingArtistCategory:
|
|
||||||
SetUIState(UIState.Initial);
|
displayLabel.Text = "";
|
||||||
await HandleTimeout("");
|
|
||||||
break;
|
switch (CurrentUIState)
|
||||||
case UIState.SelectingAction:
|
{
|
||||||
SetUIState(UIState.Initial);
|
case UIState.SelectingLanguage:
|
||||||
await HandleTimeout("");
|
case UIState.SelectingArtistCategory:
|
||||||
break;
|
case UIState.SelectingAction:
|
||||||
case UIState.SelectingSong:
|
case UIState.SelectingSong:
|
||||||
|
case UIState.SelectingArtist:
|
||||||
SetUIState(UIState.Initial);
|
case UIState.PlayHistory:
|
||||||
await HandleTimeout("");
|
SetUIState(UIState.Initial);
|
||||||
break;
|
await HandleTimeout("操作逾時,已返回主畫面");
|
||||||
case UIState.SelectingArtist:
|
break;
|
||||||
SetUIState(UIState.Initial);
|
}
|
||||||
await HandleTimeout("");
|
}
|
||||||
break;
|
finally
|
||||||
case UIState.PlayHistory:
|
{
|
||||||
SetUIState(UIState.Initial);
|
_handlingTimeout = false;
|
||||||
await HandleTimeout("");
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task HandleTimeout(string message)
|
private async Task HandleTimeout(string message)
|
||||||
{
|
{
|
||||||
Console.WriteLine("HandleTimeout called with message: " + message);
|
Console.WriteLine("HandleTimeout called with message: " + message);
|
||||||
|
unifiedTimer.Stop();
|
||||||
SetUIState(UIState.Initial);
|
SetUIState(UIState.Initial);
|
||||||
DisplayMessage(message, 2000);
|
//DisplayMessage(message, 2000);
|
||||||
|
CommandHandler._indataHistory.Clear(); // 清空歷史紀錄
|
||||||
await Task.Delay(2000);
|
await Task.Delay(2000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -880,10 +872,11 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
|||||||
control != MainForm.dynamicLabel &&
|
control != MainForm.dynamicLabel &&
|
||||||
control != MainForm.tintLabel &&
|
control != MainForm.tintLabel &&
|
||||||
control != MainForm.blackBackgroundPanel &&
|
control != MainForm.blackBackgroundPanel &&
|
||||||
control != MainForm.nextSongLabel)
|
control != MainForm.nextSongLabel)
|
||||||
{
|
{
|
||||||
MainForm.Controls.Remove(control);
|
MainForm.Controls.Remove(control);
|
||||||
control.Dispose();
|
// control.Dispose();
|
||||||
|
control.Visible = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1012,7 +1005,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
|||||||
if (songIndex >= 0 && songIndex < totalSongs)
|
if (songIndex >= 0 && songIndex < totalSongs)
|
||||||
{
|
{
|
||||||
selectedSong = LanguageSongList[songIndex];
|
selectedSong = LanguageSongList[songIndex];
|
||||||
Console.WriteLine("Adding song to playlist: " + LanguageSongList[songIndex].Song);
|
Console.WriteLine("Adding song to playlist A: " + LanguageSongList[songIndex].Song + " " + selectedSong.SongFilePathHost1);
|
||||||
|
|
||||||
|
|
||||||
// DisplayActionWithSong(currentPage, songIndex, "點播");
|
// DisplayActionWithSong(currentPage, songIndex, "點播");
|
||||||
@ -1044,7 +1037,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
|||||||
if (songIndex < totalSongs)
|
if (songIndex < totalSongs)
|
||||||
{
|
{
|
||||||
selectedSong = LanguageSongList[songIndex];
|
selectedSong = LanguageSongList[songIndex];
|
||||||
Console.WriteLine("Adding song to playlist: " + LanguageSongList[songIndex].Song);
|
Console.WriteLine("Adding song to playlist B: " + LanguageSongList[songIndex].Song + " " + selectedSong.SongFilePathHost1 );
|
||||||
|
|
||||||
|
|
||||||
// DisplayActionWithSong(currentPage, songIndex, "插播");
|
// DisplayActionWithSong(currentPage, songIndex, "插播");
|
||||||
@ -1127,11 +1120,12 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
|
|||||||
|
|
||||||
if (songIndex < totalSongs)
|
if (songIndex < totalSongs)
|
||||||
{
|
{
|
||||||
selectedSong = LanguageSongList[songIndex];
|
selectedSong = LanguageSongList[songIndex];
|
||||||
Console.WriteLine("Adding song to playlist: " + LanguageSongList[songIndex].Song);
|
Console.WriteLine("Adding song to playlist C: " + LanguageSongList[songIndex].Song + " " + selectedSong.SongFilePathHost1);
|
||||||
|
|
||||||
|
|
||||||
DisplaySongsWithArrows(currentPage, songIndex);
|
// DisplaySongsWithArrows(currentPage, songIndex);
|
||||||
|
AddSongToPlaylist(selectedSong);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1486,7 +1480,7 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
}
|
}
|
||||||
else if (category == Category.HotSongs)
|
else if (category == Category.HotSongs)
|
||||||
{
|
{
|
||||||
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY add_date DESC LIMIT {PrimaryForm.ReadHotSongLimit()}";
|
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY song_counts DESC LIMIT {PrimaryForm.ReadHotSongLimit()}";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -68,7 +68,7 @@ namespace DualScreenDemo
|
|||||||
UpdateSongList(guoYuSongs);
|
UpdateSongList(guoYuSongs);
|
||||||
|
|
||||||
SetButtonsVisibility();
|
SetButtonsVisibility();
|
||||||
HideQRCode();
|
//HideQRCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateButtonBackgrounds(Button activeButton, Image activeBackground)
|
private void UpdateButtonBackgrounds(Button activeButton, Image activeBackground)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user