開台時隱藏關台畫面

This commit is contained in:
jasonchenwork 2025-06-18 10:43:11 +08:00
parent 99ae486567
commit e77b4f4fec

View File

@ -86,28 +86,30 @@ namespace DualScreenDemo
//heartbeatSender sender = new heartbeatSender("127.0.0.1", 8888);
//sender.Start();
// Console.WriteLine($"heart beat for server{sender.RemoteEndPoint.Address}:{sender.RemoteEndPoint.Port}");
try {
string stateFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"txt","states.txt");
string stateFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "txt", "states.txt");
string initialState = ReadStateFile(stateFilePath);
/*
if (initialState.Equals("CLOSE", StringComparison.OrdinalIgnoreCase))
{
_ = SafeInvoke(PrimaryForm.Instance, () =>
{
try {
/*foreach (Control ctrl in PrimaryForm.Instance.Controls)
foreach (Control ctrl in PrimaryForm.Instance.Controls)
{
ctrl.Enabled = false;
}*/
}
PrimaryForm.Instance.ShowSendOffScreen();
}
catch (Exception ex) {
Console.WriteLine($"顯示送客畫面時發生錯誤: {ex.Message}");
}
});
}
} */
while (true)
{
@ -152,12 +154,13 @@ namespace DualScreenDemo
PrimaryForm.Instance.ShowSendOffScreen();
Console.WriteLine("開始設置新的播放列表");
string closePath = @"D:\video\CLOSE.MPG";
if (File.Exists(closePath))
{
SongData closeSong = new SongData(
"0", "結束播放", "", "", "",
closePath, "", "", "", "",
closePath, "", "", "", "",
1
);
VideoPlayerForm.publicPlaylist = new List<SongData>();
@ -167,7 +170,7 @@ namespace DualScreenDemo
{
VideoPlayerForm.playingSongList.Add(VideoPlayerForm.Instance.currentPlayingSong);
}
VideoPlayerForm.playingSongList.Add(closeSong);
VideoPlayerForm.publicPlaylist.Add(closeSong);
@ -208,14 +211,16 @@ namespace DualScreenDemo
if (command.Trim().Equals("O", StringComparison.OrdinalIgnoreCase))
{
// 開台時跳至首頁
VideoPlayerForm.publicPlaylist = new List<SongData>();
VideoPlayerForm.playingSongList = new List<SongData>();
VideoPlayerForm.Instance.PlayPublicPlaylist();
PrimaryForm.currentSongIndexInHistory = -1;
PrimaryForm.Instance.HotPlayButton_Click(null, EventArgs.Empty);
UpdateStateFile(stateFilePath, "OPEN");
PrimaryForm.Instance.HideSendOffScreen();
byte[] okResponse = Encoding.UTF8.GetBytes("OK\n");
stream.Write(okResponse, 0, okResponse.Length);
continue;
@ -237,8 +242,8 @@ namespace DualScreenDemo
continue;
}
}
if (IsFormReady(OverlayForm.MainForm))