Merge branch 'main' of http://47.251.18.130:3000/Leecheng/superstar_v2
This commit is contained in:
commit
bb00bf6e99
@ -13,9 +13,6 @@ namespace DualScreenDemo
|
|||||||
private readonly int _maxHistoryLength = 6; // 最多保留 6 筆
|
private readonly int _maxHistoryLength = 6; // 最多保留 6 筆
|
||||||
public static readonly Queue<string> _indataHistory = new Queue<string>();
|
public static readonly Queue<string> _indataHistory = new Queue<string>();
|
||||||
/* 顯示按鈕設定 */
|
/* 顯示按鈕設定 */
|
||||||
private int _wrongInputCountfor62 = 0; // 錯誤輸入計數器
|
|
||||||
private int _wrongInputCountfor61 = 0; // 錯誤輸入計數器
|
|
||||||
private const int MaxWrongLimit = 3; // 錯誤輸入限制次數
|
|
||||||
private readonly SQLManager songListManager;
|
private readonly SQLManager songListManager;
|
||||||
|
|
||||||
public CommandHandler(SQLManager songListManager)
|
public CommandHandler(SQLManager songListManager)
|
||||||
@ -33,15 +30,13 @@ namespace DualScreenDemo
|
|||||||
switch (indata)
|
switch (indata)
|
||||||
{
|
{
|
||||||
case "A261A4": // 輸入
|
case "A261A4": // 輸入
|
||||||
HandleInputA();
|
HandleInput("a");
|
||||||
break;
|
break;
|
||||||
case "A262A4": // 插播
|
case "A262A4": // 插播
|
||||||
HandleInputB();
|
HandleInput("b");
|
||||||
break;
|
break;
|
||||||
case "A263A4":
|
case "A263A4":
|
||||||
ClearDisplay();
|
ClearDisplay();
|
||||||
_wrongInputCountfor62 = 0; // 重置計數器
|
|
||||||
_wrongInputCountfor61 = 0; // 重置計數器
|
|
||||||
_indataHistory.Clear(); // 清空歷史紀錄
|
_indataHistory.Clear(); // 清空歷史紀錄
|
||||||
break;
|
break;
|
||||||
case "A268A4":
|
case "A268A4":
|
||||||
@ -199,7 +194,7 @@ namespace DualScreenDemo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InvokeAction(Action action)
|
static void InvokeAction(Action action)
|
||||||
{
|
{
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
if (OverlayForm.MainForm.InvokeRequired)
|
||||||
{
|
{
|
||||||
@ -213,39 +208,21 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static void SkipToNextSong()
|
private void SkipToNextSong()
|
||||||
{
|
{
|
||||||
if (PrimaryForm.Instance.InvokeRequired)
|
InvokeAction(() => PrimaryForm.Instance.videoPlayerForm.PlayNextSong());
|
||||||
PrimaryForm.Instance.Invoke(new System.Action(() => PrimaryForm.Instance.videoPlayerForm.PlayNextSong()));
|
InvokeAction(() => OverlayForm.MainForm.ShowTopRightEchoLabel("標準迴音"));
|
||||||
else
|
|
||||||
PrimaryForm.Instance.videoPlayerForm.PlayNextSong();
|
|
||||||
|
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() => { OverlayForm.MainForm.ShowTopRightEchoLabel("標準迴音"); } ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static void ReplayCurrentSong()
|
private void ReplayCurrentSong()
|
||||||
{
|
{
|
||||||
if (PrimaryForm.Instance.InvokeRequired)
|
InvokeAction(() => PrimaryForm.Instance.videoPlayerForm.ReplayCurrentSong());
|
||||||
{
|
|
||||||
PrimaryForm.Instance.Invoke(new System.Action(() => PrimaryForm.Instance.videoPlayerForm.ReplayCurrentSong()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PrimaryForm.Instance.videoPlayerForm.ReplayCurrentSong();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PauseOrResumeSong()
|
private static void PauseOrResumeSong()
|
||||||
{
|
{
|
||||||
if (PrimaryForm.Instance.InvokeRequired)
|
InvokeAction(() => PrimaryForm.Instance.videoPlayerForm.PauseOrResumeSong());
|
||||||
{
|
|
||||||
PrimaryForm.Instance.Invoke(new System.Action(() => PrimaryForm.Instance.videoPlayerForm.PauseOrResumeSong()));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
PrimaryForm.Instance.videoPlayerForm.PauseOrResumeSong();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ToggleMute()
|
public static void ToggleMute()
|
||||||
@ -277,205 +254,63 @@ namespace DualScreenDemo
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void HandleInputA()
|
private void HandleInput(string input)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
OverlayForm.displayTimer.Stop();
|
|
||||||
string input = "a";
|
|
||||||
|
|
||||||
// 輸入歌曲
|
|
||||||
string songNumber = OverlayForm.ReadSongNumber();
|
|
||||||
//Console.WriteLine("輸入A " + songNumber + " readyForSongListInput : " + readyForSongListInput);
|
|
||||||
var song = songListManager.SearchSongByNumber(songNumber);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (readyForSongListInput)
|
if (readyForSongListInput)
|
||||||
{
|
{
|
||||||
|
InvokeAction(() =>
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
|
||||||
{
|
{
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
Console.WriteLine("F sign for input :" + input);
|
||||||
{
|
|
||||||
Console.WriteLine("F sign for input :" + input);
|
|
||||||
OverlayForm.MainForm.OnUserInput(input);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("A sign for input :" + input);
|
|
||||||
OverlayForm.MainForm.OnUserInput(input);
|
OverlayForm.MainForm.OnUserInput(input);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
InvokeAction(() =>
|
||||||
{
|
{
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
OverlayForm.displayTimer.Stop();
|
||||||
|
string songNumber = OverlayForm.ReadSongNumber();
|
||||||
|
var song = songListManager.SearchSongByNumber(songNumber);
|
||||||
|
ClearDisplay();
|
||||||
|
if (song != null)
|
||||||
{
|
{
|
||||||
if (song != null)
|
if (Program.room.IsOpen())
|
||||||
{
|
{
|
||||||
ClearDisplay();
|
if (input.Equals("a"))
|
||||||
OverlayForm.MainForm.displayLabel.Text = String.Format("已點歌曲:{0}", song);
|
{
|
||||||
SongList.Add(song);
|
OverlayForm.MainForm.displayLabel.Text = String.Format("已點歌曲:{0}", song);
|
||||||
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
SongList.Add(song);
|
||||||
OverlayForm.displayTimer.Start();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
OverlayForm.MainForm.displayLabel.Text = String.Format("插播歌曲:{0}", song);
|
||||||
|
SongList.Insert(song);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ClearDisplay();
|
OverlayForm.MainForm.displayLabel.Text = "包廂己關閉";
|
||||||
_wrongInputCountfor61++;
|
|
||||||
if(_wrongInputCountfor61 <= MaxWrongLimit)
|
|
||||||
{
|
|
||||||
string old ="";
|
|
||||||
OverlayForm.MainForm.displayLabel.Text = check_control(old);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.displayLabel.Text = "輸入錯誤!!!";
|
|
||||||
_indataHistory.Clear(); // 清空歷史紀錄
|
|
||||||
_wrongInputCountfor61 = 0; // 重置計數器
|
|
||||||
}
|
|
||||||
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
|
||||||
OverlayForm.displayTimer.Start();
|
|
||||||
}
|
}
|
||||||
}));
|
|
||||||
}
|
_indataHistory.Clear(); // 清空歷史紀錄
|
||||||
else
|
|
||||||
{
|
|
||||||
if (song != null)
|
|
||||||
{
|
|
||||||
ClearDisplay();
|
|
||||||
OverlayForm.MainForm.displayLabel.Text = String.Format("{0}", song);
|
|
||||||
SongList.Add(song);
|
|
||||||
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
|
||||||
OverlayForm.displayTimer.Start();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
OverlayForm.MainForm.displayLabel.Text = check_control();
|
||||||
ClearDisplay();
|
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
||||||
_wrongInputCountfor61++;
|
OverlayForm.displayTimer.Start();
|
||||||
if(_wrongInputCountfor61 <= MaxWrongLimit)
|
});
|
||||||
{
|
|
||||||
string old ="";
|
|
||||||
OverlayForm.MainForm.displayLabel.Text = check_control(old);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.displayLabel.Text = "輸入錯誤!!!";
|
|
||||||
_indataHistory.Clear(); // 清空歷史紀錄
|
|
||||||
_wrongInputCountfor61 = 0; // 重置計數器
|
|
||||||
}
|
|
||||||
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
|
||||||
OverlayForm.displayTimer.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private string check_control(string old){
|
private string check_control(){
|
||||||
foreach(string item in _indataHistory)
|
string str = "";
|
||||||
|
foreach (string item in _indataHistory)
|
||||||
{
|
{
|
||||||
if(item == "A261A4")
|
if (item == "A261A4")
|
||||||
old += "#";
|
str += "#";
|
||||||
else if(item == "A262A4")
|
else if (item == "A262A4")
|
||||||
old += "*";
|
str += "*";
|
||||||
}
|
|
||||||
return old;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private void HandleInputB()
|
|
||||||
{
|
|
||||||
|
|
||||||
OverlayForm.displayTimer.Stop();
|
|
||||||
string input = "b";
|
|
||||||
|
|
||||||
|
|
||||||
string songNumber = OverlayForm.ReadSongNumber();
|
|
||||||
var song = songListManager.SearchSongByNumber(songNumber);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (readyForSongListInput)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
|
||||||
{
|
|
||||||
Console.WriteLine("B sign for input :" + input);
|
|
||||||
OverlayForm.MainForm.OnUserInput(input);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("C sign for input :" + input);
|
|
||||||
OverlayForm.MainForm.OnUserInput(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
|
||||||
{
|
|
||||||
if (song != null)
|
|
||||||
{
|
|
||||||
ClearDisplay();
|
|
||||||
OverlayForm.MainForm.displayLabel.Text = String.Format("插播歌曲{0}", song);
|
|
||||||
SongList.Insert(song);
|
|
||||||
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
|
||||||
OverlayForm.displayTimer.Start();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ClearDisplay();
|
|
||||||
_wrongInputCountfor62++;
|
|
||||||
if(_wrongInputCountfor62 <= MaxWrongLimit)
|
|
||||||
{
|
|
||||||
string old ="";
|
|
||||||
OverlayForm.MainForm.displayLabel.Text = check_control(old);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.displayLabel.Text = "輸入錯誤!!!";
|
|
||||||
_indataHistory.Clear(); // 清空歷史紀錄
|
|
||||||
_wrongInputCountfor62 = 0; // 重置計數器
|
|
||||||
}
|
|
||||||
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
|
||||||
OverlayForm.displayTimer.Start();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (song != null)
|
|
||||||
{
|
|
||||||
ClearDisplay();
|
|
||||||
OverlayForm.MainForm.displayLabel.Text = String.Format("已點歌曲:{0}", song);
|
|
||||||
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ClearDisplay();
|
|
||||||
_wrongInputCountfor62++;
|
|
||||||
if(_wrongInputCountfor62 <= MaxWrongLimit)
|
|
||||||
{
|
|
||||||
string old ="";
|
|
||||||
OverlayForm.MainForm.displayLabel.Text = check_control(old);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.displayLabel.Text = "輸入錯誤!!!";
|
|
||||||
_indataHistory.Clear(); // 清空歷史紀錄
|
|
||||||
_wrongInputCountfor62 = 0; // 重置計數器
|
|
||||||
}
|
|
||||||
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
|
||||||
OverlayForm.displayTimer.Start();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -487,14 +322,7 @@ namespace DualScreenDemo
|
|||||||
OverlayForm.displayTimer.Stop();
|
OverlayForm.displayTimer.Stop();
|
||||||
|
|
||||||
// 判斷是否需要透過 Invoke 回 UI 執行緒執行
|
// 判斷是否需要透過 Invoke 回 UI 執行緒執行
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
InvokeAction(() => ClearControlsAndReset());
|
||||||
{
|
|
||||||
OverlayForm.MainForm.Invoke(new Action(ClearControlsAndReset));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ClearControlsAndReset();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -566,23 +394,14 @@ namespace DualScreenDemo
|
|||||||
// 錨點 遙控器
|
// 錨點 遙控器
|
||||||
|
|
||||||
// 安全更新 UI:若非 UI 執行緒則使用 Invoke 切換
|
// 安全更新 UI:若非 UI 執行緒則使用 Invoke 切換
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
InvokeAction(() =>
|
||||||
{
|
{
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
// 更新主畫面的歷史播放顯示區
|
||||||
{
|
|
||||||
// 更新主畫面的歷史播放顯示區
|
|
||||||
OverlayForm.MainForm.UpdateHistoryLabel(historySongs, OverlayForm.MainForm.currentPage, totalPages);
|
|
||||||
|
|
||||||
// 隱藏下一首提示
|
|
||||||
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// 若已在 UI 執行緒,直接操作
|
|
||||||
OverlayForm.MainForm.UpdateHistoryLabel(historySongs, OverlayForm.MainForm.currentPage, totalPages);
|
OverlayForm.MainForm.UpdateHistoryLabel(historySongs, OverlayForm.MainForm.currentPage, totalPages);
|
||||||
|
|
||||||
|
// 隱藏下一首提示
|
||||||
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
||||||
}
|
});
|
||||||
|
|
||||||
// 切換 UI 狀態為播放歷史模式(可做為內部狀態管理用途)
|
// 切換 UI 狀態為播放歷史模式(可做為內部狀態管理用途)
|
||||||
OverlayForm.SetUIState(OverlayForm.UIState.PlayHistory);
|
OverlayForm.SetUIState(OverlayForm.UIState.PlayHistory);
|
||||||
@ -595,55 +414,18 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
if (OverlayForm.CurrentUIState == OverlayForm.UIState.SelectingSong)
|
if (OverlayForm.CurrentUIState == OverlayForm.UIState.SelectingSong)
|
||||||
{
|
{
|
||||||
|
InvokeAction(() =>OverlayForm.MainForm.PreviousPage());
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
|
||||||
{
|
|
||||||
|
|
||||||
OverlayForm.MainForm.PreviousPage();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
OverlayForm.MainForm.PreviousPage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (OverlayForm.CurrentUIState == OverlayForm.UIState.SelectingArtist)
|
else if (OverlayForm.CurrentUIState == OverlayForm.UIState.SelectingArtist)
|
||||||
{
|
{
|
||||||
|
InvokeAction(() =>OverlayForm.MainForm.PreviousPage());
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
|
||||||
{
|
|
||||||
|
|
||||||
OverlayForm.MainForm.PreviousPage();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
OverlayForm.MainForm.PreviousPage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (OverlayForm.CurrentUIState == OverlayForm.UIState.PlayHistory)
|
else if (OverlayForm.CurrentUIState == OverlayForm.UIState.PlayHistory)
|
||||||
{
|
{
|
||||||
if (OverlayForm.MainForm.currentPage > 1)
|
if (OverlayForm.MainForm.currentPage > 1)
|
||||||
{
|
{
|
||||||
OverlayForm.MainForm.currentPage--;
|
OverlayForm.MainForm.currentPage--;
|
||||||
|
InvokeAction(() => DisplaySongHistory());
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
|
||||||
{
|
|
||||||
DisplaySongHistory();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DisplaySongHistory();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -656,37 +438,11 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
if (OverlayForm.CurrentUIState == OverlayForm.UIState.SelectingSong)
|
if (OverlayForm.CurrentUIState == OverlayForm.UIState.SelectingSong)
|
||||||
{
|
{
|
||||||
|
InvokeAction(() => OverlayForm.MainForm.NextPage());
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
|
||||||
{
|
|
||||||
|
|
||||||
OverlayForm.MainForm.NextPage();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
OverlayForm.MainForm.NextPage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (OverlayForm.CurrentUIState == OverlayForm.UIState.SelectingArtist)
|
else if (OverlayForm.CurrentUIState == OverlayForm.UIState.SelectingArtist)
|
||||||
{
|
{
|
||||||
|
InvokeAction(() => OverlayForm.MainForm.NextPage() );
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
|
||||||
{
|
|
||||||
|
|
||||||
OverlayForm.MainForm.NextPage();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
OverlayForm.MainForm.NextPage();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (OverlayForm.CurrentUIState == OverlayForm.UIState.PlayHistory)
|
else if (OverlayForm.CurrentUIState == OverlayForm.UIState.PlayHistory)
|
||||||
{
|
{
|
||||||
@ -695,17 +451,7 @@ namespace DualScreenDemo
|
|||||||
OverlayForm.MainForm.currentPage++;
|
OverlayForm.MainForm.currentPage++;
|
||||||
if (OverlayForm.CurrentUIState == OverlayForm.UIState.PlayHistory)
|
if (OverlayForm.CurrentUIState == OverlayForm.UIState.PlayHistory)
|
||||||
{
|
{
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
InvokeAction(() => DisplaySongHistory() );
|
||||||
{
|
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
|
||||||
{
|
|
||||||
DisplaySongHistory();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DisplaySongHistory();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -803,30 +549,8 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
private static void UpdateDisplayLabels(string[] messages)
|
private static void UpdateDisplayLabels(string[] messages)
|
||||||
{
|
{
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
InvokeAction(() =>
|
||||||
{
|
{
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (var control in OverlayForm.MainForm.Controls.OfType<Control>().ToArray())
|
|
||||||
{
|
|
||||||
if (control != OverlayForm.MainForm.displayLabel &&
|
|
||||||
control != OverlayForm.MainForm.pauseLabel &&
|
|
||||||
control != OverlayForm.MainForm.muteLabel &&
|
|
||||||
control != OverlayForm.MainForm.topRightLabel &&
|
|
||||||
control != OverlayForm.MainForm.blackBackgroundPanel &&
|
|
||||||
control != OverlayForm.MainForm.topLeftLabel)
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.Controls.Remove(control);
|
|
||||||
control.Dispose();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
OverlayForm.MainForm.UpdateDisplayLabels(messages);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
foreach (var control in OverlayForm.MainForm.Controls.OfType<Control>().ToArray())
|
foreach (var control in OverlayForm.MainForm.Controls.OfType<Control>().ToArray())
|
||||||
{
|
{
|
||||||
if (control != OverlayForm.MainForm.displayLabel &&
|
if (control != OverlayForm.MainForm.displayLabel &&
|
||||||
@ -841,7 +565,7 @@ namespace DualScreenDemo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
OverlayForm.MainForm.UpdateDisplayLabels(messages);
|
OverlayForm.MainForm.UpdateDisplayLabels(messages);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void HandleNumberInput(string trimmedData)
|
private static void HandleNumberInput(string trimmedData)
|
||||||
@ -861,38 +585,19 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
if (readyForSongListInput)
|
if (readyForSongListInput)
|
||||||
{
|
{
|
||||||
|
InvokeAction(() =>
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
|
||||||
{
|
{
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
Console.WriteLine("D sign for number :" + number);
|
||||||
{
|
|
||||||
Console.WriteLine("D sign for number :" + number);
|
|
||||||
OverlayForm.MainForm.OnUserInput(number);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine("E sign for number :" + number);
|
|
||||||
OverlayForm.MainForm.OnUserInput(number);
|
OverlayForm.MainForm.OnUserInput(number);
|
||||||
}
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
InvokeAction(() =>
|
||||||
if (OverlayForm.MainForm.InvokeRequired)
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.Invoke(new System.Action(() =>
|
|
||||||
{
|
|
||||||
OverlayForm.MainForm.HideTopRightLabels();
|
|
||||||
OverlayForm.DisplayNumberAtTopLeft(number);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
OverlayForm.MainForm.HideTopRightLabels();
|
OverlayForm.MainForm.HideTopRightLabels();
|
||||||
OverlayForm.DisplayNumberAtTopLeft(number);
|
OverlayForm.DisplayNumberAtTopLeft(number);
|
||||||
}
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,12 +54,12 @@ namespace DBObj
|
|||||||
*/
|
*/
|
||||||
public List<SongData> SearchNewSongs()
|
public List<SongData> SearchNewSongs()
|
||||||
{
|
{
|
||||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY add_date DESC LIMIT {Utils.Env.GetInt("NewSongLimit", 100)};";
|
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY add_date DESC LIMIT 1000;";
|
||||||
return select_Mysql(query);
|
return select_Mysql(query);
|
||||||
}
|
}
|
||||||
public List<SongData> SearchHotSongs()
|
public List<SongData> SearchHotSongs()
|
||||||
{
|
{
|
||||||
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_counts DESC LIMIT {Utils.Env.GetInt("HotSongLimit", 100)};";
|
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_counts DESC LIMIT 1000;";
|
||||||
return select_Mysql(query);
|
return select_Mysql(query);
|
||||||
}
|
}
|
||||||
public List<SongData> SearchSongsBySinger(string keyword)
|
public List<SongData> SearchSongsBySinger(string keyword)
|
||||||
|
@ -141,10 +141,7 @@ namespace DBObj
|
|||||||
public int getHumanVoice() { return basic.getHumanVoice(); }
|
public int getHumanVoice() { return basic.getHumanVoice(); }
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
{
|
{
|
||||||
|
return String.Format("{0} {1}", basic.getName(),state.GetDescription() );
|
||||||
return B!=null
|
|
||||||
? String.Format("{0} - {1} - {2} - {3}", state, A.getName(), B.getName(), basic.getName())
|
|
||||||
: String.Format("{0} - {1} - {2}", state, A.getName(), basic.getName());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -129,6 +129,19 @@ namespace DBObj
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public static void roomClose()
|
||||||
|
{
|
||||||
|
SongData song;
|
||||||
|
while (not_played.Count > 0)
|
||||||
|
{
|
||||||
|
song = not_played[0];
|
||||||
|
not_played.RemoveAt(0);
|
||||||
|
song.SetState(PlayState.Skipped);
|
||||||
|
played.Add(song);
|
||||||
|
}
|
||||||
|
|
||||||
|
Add(close);
|
||||||
|
}
|
||||||
public static void clearSong()
|
public static void clearSong()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -136,5 +149,6 @@ namespace DBObj
|
|||||||
not_played.Clear();
|
not_played.Clear();
|
||||||
played.Clear();
|
played.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1303,11 +1303,11 @@ private void DisplayArtists(List<Artist> artists, int page)//歌星點進去後
|
|||||||
|
|
||||||
if (category == Category.NewSongs)
|
if (category == Category.NewSongs)
|
||||||
{
|
{
|
||||||
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY add_date DESC LIMIT {Utils.Env.GetInt("NewSongLimit", 100)};";
|
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY add_date DESC LIMIT 1000;";
|
||||||
}
|
}
|
||||||
else if (category == Category.HotSongs)
|
else if (category == Category.HotSongs)
|
||||||
{
|
{
|
||||||
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY song_counts DESC LIMIT {Utils.Env.GetInt("HotSongLimit", 100)};";
|
sqlQuery = $"SELECT * FROM song_library_cache WHERE language_name = '{language}' ORDER BY song_counts DESC LIMIT 1000;";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -83,7 +83,6 @@ namespace DualScreenDemo
|
|||||||
/* 清空搜尋欄 */
|
/* 清空搜尋欄 */
|
||||||
ResetinputBox();
|
ResetinputBox();
|
||||||
|
|
||||||
|
|
||||||
string query = setQueryforNewSong("國語");
|
string query = setQueryforNewSong("國語");
|
||||||
var guoYuSongs2 = SearchSongs_Mysql(query);
|
var guoYuSongs2 = SearchSongs_Mysql(query);
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
|
@ -13,7 +13,7 @@ namespace DualScreenDemo
|
|||||||
private static PrimaryForm primaryForm; // 儲存實例的參考
|
private static PrimaryForm primaryForm; // 儲存實例的參考
|
||||||
public static Room room = new Room();
|
public static Room room = new Room();
|
||||||
|
|
||||||
public static string verSion = "Server V2.6 202508011600";
|
public static string verSion = "Server V2.7 202508041725";
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
|
@ -57,7 +57,7 @@ namespace DataCheck
|
|||||||
if (fileName == "welcome") {
|
if (fileName == "welcome") {
|
||||||
DBObj.SongList.welcome=new SongData("0", "歡迎光臨", @"D:\video\welcome.mpg", 1 ,true);
|
DBObj.SongList.welcome=new SongData("0", "歡迎光臨", @"D:\video\welcome.mpg", 1 ,true);
|
||||||
} else if (fileName == "CLOSE") {
|
} else if (fileName == "CLOSE") {
|
||||||
DBObj.SongList.close =new SongData("0", "結束播放", @"D:\video\CLOSE.MPG", 1 ,true);
|
DBObj.SongList.close =new SongData("0", "謝謝光臨", @"D:\video\CLOSE.MPG", 1 ,true);
|
||||||
} else {
|
} else {
|
||||||
//Console.WriteLine($"{fileName} {Path.Combine(localPath, serverFile.Key)}");
|
//Console.WriteLine($"{fileName} {Path.Combine(localPath, serverFile.Key)}");
|
||||||
publicList.Add(new SongData(
|
publicList.Add(new SongData(
|
||||||
|
30
Room.cs
30
Room.cs
@ -11,12 +11,14 @@ namespace DualScreenDemo
|
|||||||
public string hostName;
|
public string hostName;
|
||||||
|
|
||||||
private string State = "error";
|
private string State = "error";
|
||||||
|
private DateTime? startedAt;
|
||||||
|
private DateTime? endedAt;
|
||||||
public Room()
|
public Room()
|
||||||
{
|
{
|
||||||
hostName = System.Net.Dns.GetHostName();
|
hostName = System.Net.Dns.GetHostName();
|
||||||
branch_id =getBranchId();
|
branch_id = getBranchId();
|
||||||
State =getDB();
|
State = getDB();
|
||||||
Console.WriteLine($"hostname status: {hostName},{State}");
|
Console.WriteLine($"hostname status: {hostName},{State},{startedAt},{endedAt}");
|
||||||
}
|
}
|
||||||
private int getBranchId()
|
private int getBranchId()
|
||||||
{
|
{
|
||||||
@ -40,7 +42,9 @@ namespace DualScreenDemo
|
|||||||
if (db.open(query, parameters) && db.found())
|
if (db.open(query, parameters) && db.found())
|
||||||
{
|
{
|
||||||
State = db.Field<string>("status");
|
State = db.Field<string>("status");
|
||||||
if (State.Equals("maintai")) { State = "active"; }
|
startedAt=ParseTime(db.Field<string>("started_at"));
|
||||||
|
endedAt=ParseTime(db.Field<string>("ended_at"));
|
||||||
|
if (State.Equals("maintain")) { State = "active"; }
|
||||||
return State;
|
return State;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -61,16 +65,18 @@ namespace DualScreenDemo
|
|||||||
}
|
}
|
||||||
public void set(string value)
|
public void set(string value)
|
||||||
{
|
{
|
||||||
|
State =getDB();
|
||||||
|
Console.WriteLine($"hostname status: {hostName},{State},{startedAt},{endedAt}");
|
||||||
string marqueeMessage = "歡迎使用超級巨星歡唱,與你共度美好時光。";
|
string marqueeMessage = "歡迎使用超級巨星歡唱,與你共度美好時光。";
|
||||||
Color c = Color.White;
|
Color c = Color.White;
|
||||||
if (value.Equals("fire"))
|
if (State.Equals("fire"))
|
||||||
{
|
{
|
||||||
PrimaryForm.Instance.ShowSendOffScreen();
|
PrimaryForm.Instance.ShowSendOffScreen();
|
||||||
VideoPlayerForm.Instance.Pause();
|
VideoPlayerForm.Instance.Pause();
|
||||||
marqueeMessage = "發生火災,請跟隨引導至逃生出口!!!";
|
marqueeMessage = "發生火災,請跟隨引導至逃生出口!!!";
|
||||||
c = Color.Red;
|
c = Color.Red;
|
||||||
}
|
}
|
||||||
else if (value.Equals("active"))
|
else if (State.Equals("active"))
|
||||||
{
|
{
|
||||||
DBObj.SongList.clearSong();
|
DBObj.SongList.clearSong();
|
||||||
PrimaryForm.Instance.HotPlayButton_Click(null, EventArgs.Empty);
|
PrimaryForm.Instance.HotPlayButton_Click(null, EventArgs.Empty);
|
||||||
@ -78,7 +84,7 @@ namespace DualScreenDemo
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DBObj.SongList.clearSong();
|
DBObj.SongList.roomClose();
|
||||||
PrimaryForm.Instance.pictureBoxQRCode.Visible = false;
|
PrimaryForm.Instance.pictureBoxQRCode.Visible = false;
|
||||||
PrimaryForm.Instance.closeQRCodeButton.Visible = false;
|
PrimaryForm.Instance.closeQRCodeButton.Visible = false;
|
||||||
PrimaryForm.Instance.ShowSendOffScreen();
|
PrimaryForm.Instance.ShowSendOffScreen();
|
||||||
@ -86,14 +92,20 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
OverlayForm.MainForm.topLeftLabel.Visible = false;
|
||||||
|
|
||||||
VideoPlayerForm.Instance.PlayNextSong();
|
//VideoPlayerForm.Instance.PlayNextSong();
|
||||||
PrimaryForm.Instance.logout();
|
PrimaryForm.Instance.logout();
|
||||||
|
|
||||||
}
|
}
|
||||||
State =getDB();
|
|
||||||
OverlayForm.MainForm.UpdateMarqueeText(marqueeMessage, OverlayForm.MarqueeStartPosition.Middle, c);
|
OverlayForm.MainForm.UpdateMarqueeText(marqueeMessage, OverlayForm.MarqueeStartPosition.Middle, c);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private DateTime? ParseTime(string value)
|
||||||
|
{
|
||||||
|
if (DateTime.TryParse(value, out var dt))
|
||||||
|
return dt;
|
||||||
|
return null;
|
||||||
|
}
|
||||||
public bool IsClose()
|
public bool IsClose()
|
||||||
{
|
{
|
||||||
return State.Equals("closed");
|
return State.Equals("closed");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user