調整 右上Labels 與 左上Labels 20250716

This commit is contained in:
jasonchenwork 2025-07-16 18:25:56 +08:00
parent d545c0d8c4
commit 3fc4eeb497
13 changed files with 207 additions and 1251 deletions

View File

@ -87,102 +87,73 @@ namespace DualScreenDemo
HandleArtistAnnouncements(); HandleArtistAnnouncements();
break; break;
case "A2B3A4": case "A2B3A4":
SafeInvokeAction("A2B3A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A2B3A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↑ "));
SafeInvokeAction("A2B3A4",() => OverlayForm.MainForm.ShowVolumeUpLabel());
break; break;
case "A2B4A4": case "A2B4A4":
SafeInvokeAction("A2B4A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A2B4A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↓ "));
SafeInvokeAction("A2B4A4",() => OverlayForm.MainForm.ShowVolumeDownLabel());
break; break;
case "A2B5A4": case "A2B5A4":
SafeInvokeAction("A2B5A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A2B5A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↑ "));
SafeInvokeAction("A2B5A4",() => OverlayForm.MainForm.ShowMicUpLabel());
break; break;
case "A2B6A4": case "A2B6A4":
SafeInvokeAction("A2B6A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A2B6A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↓ "));
SafeInvokeAction("A2B6A4",() => OverlayForm.MainForm.ShowMicDownLabel());
break; break;
case "A2C2A4": case "A2C2A4":
SafeInvokeAction("A2C2A4",() => OverlayForm.MainForm.HidemicLabels()); SafeInvokeAction("A2C2A4",() => OverlayForm.MainForm.ShowTopRightEchoLabel("標準迴音"));
SafeInvokeAction("A2C2A4",() => OverlayForm.MainForm.ShowStandardLabel());
break; break;
case "A2C3A4": case "A2C3A4":
SafeInvokeAction("A2C3A4",() => OverlayForm.MainForm.HidemicLabels()); SafeInvokeAction("A2C3A4",() => OverlayForm.MainForm.ShowTopRightEchoLabel("專業迴音"));
SafeInvokeAction("A2C3A4",() => OverlayForm.MainForm.ShowProfessionalLabel());
break; break;
case "A2C4A4": case "A2C4A4":
SafeInvokeAction("A2C4A4",() => OverlayForm.MainForm.HidemicLabels()); SafeInvokeAction("A2C4A4",() => OverlayForm.MainForm.ShowTopRightEchoLabel("廣場迴音"));
SafeInvokeAction("A2C4A4",() => OverlayForm.MainForm.ShowSquareLabel());
break; break;
case "A2C1A4": case "A2C1A4":
SafeInvokeAction("A2C1A4",() => OverlayForm.MainForm.HidemicLabels()); SafeInvokeAction("A2C1A4",() => OverlayForm.MainForm.ShowTopRightEchoLabel("唱將迴音"));
SafeInvokeAction("A2C1A4",() => OverlayForm.MainForm.ShowSingDownLabel());
break; break;
case "A2D5A4": case "A2D5A4":
SafeInvokeAction("A2D5A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A2D5A4",() => OverlayForm.MainForm.ShowTopRightLabelTime(" 明亮 "));
SafeInvokeAction("A2D5A4",() => OverlayForm.MainForm.ShowBrightLabel());
break; break;
case "A2D7A4": case "A2D7A4":
SafeInvokeAction("A2D7A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A2D7A4",() => OverlayForm.MainForm.ShowTopRightLabelTime(" 浪漫 "));
SafeInvokeAction("A2D7A4",() => OverlayForm.MainForm.ShowRomanticLabel());
break; break;
/* case "A27CA4":
InvokeAction(() => OverlayForm.MainForm.ShowMaleKeyLabel());
break;
case "A282A4":
InvokeAction(() => OverlayForm.MainForm.ShowFemaleKeyLabel());
break;*/
case "A2D6A4": case "A2D6A4":
SafeInvokeAction("A2D6A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A2D6A4",() => OverlayForm.MainForm.ShowTopRightLabelTime(" 柔和 "));
SafeInvokeAction("A2D6A4",() => OverlayForm.MainForm.ShowSoftLabel());
break; break;
case "A2D8A4": case "A2D8A4":
SafeInvokeAction("A2D8A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A2D8A4",() => OverlayForm.MainForm.ShowTopRightLabelTime(" 動感 "));
SafeInvokeAction("A2D8A4",() => OverlayForm.MainForm.ShowDynamicLabel());
break; break;
case "A275A4": case "A275A4":
SafeInvokeAction("A275A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A275A4",() => OverlayForm.MainForm.ShowTopRightLabelTime(" 調色 "));
SafeInvokeAction("A275A4",() => OverlayForm.MainForm.ShowTintLabel());
break; break;
case "A283A4": case "A283A4":
SafeInvokeAction("A283A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A283A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↑升4調 "));
SafeInvokeAction("A283A4",() => OverlayForm.MainForm.ShowKeyUpLabel("↑升4調"));
break; break;
case "A282A4": case "A282A4":
SafeInvokeAction("A282A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A282A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↑升3調 "));
SafeInvokeAction("A282A4",() => OverlayForm.MainForm.ShowKeyUpLabel("↑升3調"));
break; break;
case "A281A4": case "A281A4":
SafeInvokeAction("A281A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A281A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↑升2調 "));
SafeInvokeAction("A281A4",() => OverlayForm.MainForm.ShowKeyUpLabel("↑升2調"));
break; break;
case "A280A4": case "A280A4":
SafeInvokeAction("A280A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A280A4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↑升1調 "));
SafeInvokeAction("A280A4",() => OverlayForm.MainForm.ShowKeyUpLabel("↑升1調"));
break; break;
case "A27FA4": case "A27FA4":
SafeInvokeAction("A27FA4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A27FA4",() => OverlayForm.MainForm.ShowTopRightLabelTime(" 標準調 "));
SafeInvokeAction("A27FA4",() => OverlayForm.MainForm.ShowStandardKeyLabel());
break; break;
case "A27EA4": case "A27EA4":
SafeInvokeAction("A27EA4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A27EA4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↓降1調 "));
SafeInvokeAction("A27EA4",() => OverlayForm.MainForm.ShowKeyDownLabel("↓降1調"));
break; break;
case "A27DA4": case "A27DA4":
SafeInvokeAction("A27EA4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A27EA4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↓降2調 "));
SafeInvokeAction("A27EA4",() => OverlayForm.MainForm.ShowKeyDownLabel("↓降2調"));
break; break;
case "A27CA4": case "A27CA4":
SafeInvokeAction("A27CA4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A27CA4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↓降3調 "));
SafeInvokeAction("A27CA4",() => OverlayForm.MainForm.ShowKeyDownLabel("↓降3調"));
break; break;
case "A27BA4": case "A27BA4":
SafeInvokeAction("A27BA4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A27BA4",() => OverlayForm.MainForm.ShowTopRightLabelTime("↓降4調 "));
SafeInvokeAction("A27BA4",() => OverlayForm.MainForm.ShowKeyDownLabel("↓降4調"));
break; break;
case "A266A4": case "A266A4":
SafeInvokeAction("A266A4",() => OverlayForm.MainForm.HideAllLabels()); SafeInvokeAction("A266A4",() => OverlayForm.MainForm.ShowTopRightLabel("服務鈴"));
SafeInvokeAction("A266A4",() => OverlayForm.MainForm.ShowServiceBell());
break; break;
default: default:
if (Regex.IsMatch(indata, @"^A23\d+A4$")) if (Regex.IsMatch(indata, @"^A23\d+A4$"))
@ -249,7 +220,7 @@ namespace DualScreenDemo
else else
PrimaryForm.Instance.videoPlayerForm.PlayNextSong(); PrimaryForm.Instance.videoPlayerForm.PlayNextSong();
OverlayForm.MainForm.Invoke(new System.Action(() => { OverlayForm.MainForm.ShowStandardLabel(); } ) ); OverlayForm.MainForm.Invoke(new System.Action(() => { OverlayForm.MainForm.ShowTopRightEchoLabel("標準迴音"); } ) );
} }
@ -348,7 +319,7 @@ namespace DualScreenDemo
ClearDisplay(); ClearDisplay();
OverlayForm.MainForm.displayLabel.Text = String.Format("已點歌曲:{0}", song); OverlayForm.MainForm.displayLabel.Text = String.Format("已點歌曲:{0}", song);
SongList.Add(song); SongList.Add(song);
OverlayForm.MainForm.nextSongLabel.Visible = false; OverlayForm.MainForm.topLeftLabel.Visible = false;
OverlayForm.displayTimer.Start(); OverlayForm.displayTimer.Start();
} }
else else
@ -366,7 +337,7 @@ namespace DualScreenDemo
_indataHistory.Clear(); // 清空歷史紀錄 _indataHistory.Clear(); // 清空歷史紀錄
_wrongInputCountfor61 = 0; // 重置計數器 _wrongInputCountfor61 = 0; // 重置計數器
} }
OverlayForm.MainForm.nextSongLabel.Visible = false; OverlayForm.MainForm.topLeftLabel.Visible = false;
OverlayForm.displayTimer.Start(); OverlayForm.displayTimer.Start();
} }
})); }));
@ -378,7 +349,7 @@ namespace DualScreenDemo
ClearDisplay(); ClearDisplay();
OverlayForm.MainForm.displayLabel.Text = String.Format("{0}", song); OverlayForm.MainForm.displayLabel.Text = String.Format("{0}", song);
SongList.Add(song); SongList.Add(song);
OverlayForm.MainForm.nextSongLabel.Visible = false; OverlayForm.MainForm.topLeftLabel.Visible = false;
OverlayForm.displayTimer.Start(); OverlayForm.displayTimer.Start();
} }
else else
@ -396,7 +367,7 @@ namespace DualScreenDemo
_indataHistory.Clear(); // 清空歷史紀錄 _indataHistory.Clear(); // 清空歷史紀錄
_wrongInputCountfor61 = 0; // 重置計數器 _wrongInputCountfor61 = 0; // 重置計數器
} }
OverlayForm.MainForm.nextSongLabel.Visible = false; OverlayForm.MainForm.topLeftLabel.Visible = false;
OverlayForm.displayTimer.Start(); OverlayForm.displayTimer.Start();
} }
} }
@ -454,7 +425,7 @@ namespace DualScreenDemo
ClearDisplay(); ClearDisplay();
OverlayForm.MainForm.displayLabel.Text = String.Format("插播歌曲{0}", song); OverlayForm.MainForm.displayLabel.Text = String.Format("插播歌曲{0}", song);
SongList.Insert(song); SongList.Insert(song);
OverlayForm.MainForm.nextSongLabel.Visible = false; OverlayForm.MainForm.topLeftLabel.Visible = false;
OverlayForm.displayTimer.Start(); OverlayForm.displayTimer.Start();
} }
else else
@ -472,7 +443,7 @@ namespace DualScreenDemo
_indataHistory.Clear(); // 清空歷史紀錄 _indataHistory.Clear(); // 清空歷史紀錄
_wrongInputCountfor62 = 0; // 重置計數器 _wrongInputCountfor62 = 0; // 重置計數器
} }
OverlayForm.MainForm.nextSongLabel.Visible = false; OverlayForm.MainForm.topLeftLabel.Visible = false;
OverlayForm.displayTimer.Start(); OverlayForm.displayTimer.Start();
} }
})); }));
@ -483,7 +454,7 @@ namespace DualScreenDemo
{ {
ClearDisplay(); ClearDisplay();
OverlayForm.MainForm.displayLabel.Text = String.Format("已點歌曲:{0}", song); OverlayForm.MainForm.displayLabel.Text = String.Format("已點歌曲:{0}", song);
OverlayForm.MainForm.nextSongLabel.Visible = false; OverlayForm.MainForm.topLeftLabel.Visible = false;
} }
else else
{ {
@ -500,7 +471,7 @@ namespace DualScreenDemo
_indataHistory.Clear(); // 清空歷史紀錄 _indataHistory.Clear(); // 清空歷史紀錄
_wrongInputCountfor62 = 0; // 重置計數器 _wrongInputCountfor62 = 0; // 重置計數器
} }
OverlayForm.MainForm.nextSongLabel.Visible = false; OverlayForm.MainForm.topLeftLabel.Visible = false;
OverlayForm.displayTimer.Start(); OverlayForm.displayTimer.Start();
} }
} }
@ -537,27 +508,9 @@ namespace DualScreenDemo
OverlayForm.MainForm.displayLabel, OverlayForm.MainForm.displayLabel,
OverlayForm.MainForm.pauseLabel, OverlayForm.MainForm.pauseLabel,
OverlayForm.MainForm.muteLabel, OverlayForm.MainForm.muteLabel,
OverlayForm.MainForm.volumeUpLabel, OverlayForm.MainForm.topRightLabel,
OverlayForm.MainForm.volumeDownLabel,
OverlayForm.MainForm.micUpLabel,
OverlayForm.MainForm.micDownLabel,
OverlayForm.MainForm.standardKeyLabel,
OverlayForm.MainForm.keyUpLabel,
OverlayForm.MainForm.keyDownLabel,
OverlayForm.MainForm.maleKeyLabel,
OverlayForm.MainForm.femaleKeyLabel,
OverlayForm.MainForm.squareLabel,
OverlayForm.MainForm.professionalLabel,
OverlayForm.MainForm.standardLabel,
OverlayForm.MainForm.singDownLabel,
OverlayForm.MainForm.brightLabel,
OverlayForm.MainForm.softLabel,
OverlayForm.MainForm.autoLabel,
OverlayForm.MainForm.romanticLabel,
OverlayForm.MainForm.dynamicLabel,
OverlayForm.MainForm.tintLabel,
OverlayForm.MainForm.blackBackgroundPanel, OverlayForm.MainForm.blackBackgroundPanel,
OverlayForm.MainForm.nextSongLabel OverlayForm.MainForm.topLeftLabel
}; };
// 將所有不在保留清單內的控制項移除並釋放資源 // 將所有不在保留清單內的控制項移除並釋放資源
@ -617,14 +570,14 @@ namespace DualScreenDemo
OverlayForm.MainForm.UpdateHistoryLabel(historySongs, OverlayForm.MainForm.currentPage, totalPages); OverlayForm.MainForm.UpdateHistoryLabel(historySongs, OverlayForm.MainForm.currentPage, totalPages);
// 隱藏下一首提示 // 隱藏下一首提示
OverlayForm.MainForm.nextSongLabel.Visible = false; OverlayForm.MainForm.topLeftLabel.Visible = false;
})); }));
} }
else else
{ {
// 若已在 UI 執行緒,直接操作 // 若已在 UI 執行緒,直接操作
OverlayForm.MainForm.UpdateHistoryLabel(historySongs, OverlayForm.MainForm.currentPage, totalPages); OverlayForm.MainForm.UpdateHistoryLabel(historySongs, OverlayForm.MainForm.currentPage, totalPages);
OverlayForm.MainForm.nextSongLabel.Visible = false; OverlayForm.MainForm.topLeftLabel.Visible = false;
} }
// 切換 UI 狀態為播放歷史模式(可做為內部狀態管理用途) // 切換 UI 狀態為播放歷史模式(可做為內部狀態管理用途)
@ -856,27 +809,9 @@ namespace DualScreenDemo
if (control != OverlayForm.MainForm.displayLabel && if (control != OverlayForm.MainForm.displayLabel &&
control != OverlayForm.MainForm.pauseLabel && control != OverlayForm.MainForm.pauseLabel &&
control != OverlayForm.MainForm.muteLabel && control != OverlayForm.MainForm.muteLabel &&
control != OverlayForm.MainForm.volumeUpLabel && control != OverlayForm.MainForm.topRightLabel &&
control != OverlayForm.MainForm.volumeDownLabel &&
control != OverlayForm.MainForm.micUpLabel &&
control != OverlayForm.MainForm.micDownLabel &&
control != OverlayForm.MainForm.standardKeyLabel &&
control != OverlayForm.MainForm.keyUpLabel &&
control != OverlayForm.MainForm.keyDownLabel &&
control != OverlayForm.MainForm.maleKeyLabel &&
control != OverlayForm.MainForm.femaleKeyLabel &&
control != OverlayForm.MainForm.squareLabel &&
control != OverlayForm.MainForm.professionalLabel &&
control != OverlayForm.MainForm.standardLabel &&
control != OverlayForm.MainForm.singDownLabel &&
control != OverlayForm.MainForm.brightLabel &&
control != OverlayForm.MainForm.softLabel &&
control != OverlayForm.MainForm.autoLabel &&
control != OverlayForm.MainForm.romanticLabel &&
control != OverlayForm.MainForm.dynamicLabel &&
control != OverlayForm.MainForm.tintLabel &&
control != OverlayForm.MainForm.blackBackgroundPanel && control != OverlayForm.MainForm.blackBackgroundPanel &&
control != OverlayForm.MainForm.nextSongLabel) control != OverlayForm.MainForm.topLeftLabel)
{ {
OverlayForm.MainForm.Controls.Remove(control); OverlayForm.MainForm.Controls.Remove(control);
control.Dispose(); control.Dispose();
@ -893,27 +828,9 @@ namespace DualScreenDemo
if (control != OverlayForm.MainForm.displayLabel && if (control != OverlayForm.MainForm.displayLabel &&
control != OverlayForm.MainForm.pauseLabel && control != OverlayForm.MainForm.pauseLabel &&
control != OverlayForm.MainForm.muteLabel && control != OverlayForm.MainForm.muteLabel &&
control != OverlayForm.MainForm.volumeUpLabel && control != OverlayForm.MainForm.topRightLabel &&
control != OverlayForm.MainForm.volumeDownLabel &&
control != OverlayForm.MainForm.micUpLabel &&
control != OverlayForm.MainForm.micDownLabel &&
control != OverlayForm.MainForm.standardKeyLabel &&
control != OverlayForm.MainForm.keyUpLabel &&
control != OverlayForm.MainForm.keyDownLabel &&
control != OverlayForm.MainForm.maleKeyLabel &&
control != OverlayForm.MainForm.femaleKeyLabel &&
control != OverlayForm.MainForm.squareLabel &&
control != OverlayForm.MainForm.professionalLabel &&
control != OverlayForm.MainForm.standardLabel &&
control != OverlayForm.MainForm.singDownLabel &&
control != OverlayForm.MainForm.brightLabel &&
control != OverlayForm.MainForm.softLabel &&
control != OverlayForm.MainForm.autoLabel &&
control != OverlayForm.MainForm.romanticLabel &&
control != OverlayForm.MainForm.dynamicLabel &&
control != OverlayForm.MainForm.tintLabel &&
control != OverlayForm.MainForm.blackBackgroundPanel && control != OverlayForm.MainForm.blackBackgroundPanel &&
control != OverlayForm.MainForm.nextSongLabel) control != OverlayForm.MainForm.topLeftLabel)
{ {
OverlayForm.MainForm.Controls.Remove(control); OverlayForm.MainForm.Controls.Remove(control);
control.Dispose(); control.Dispose();
@ -963,14 +880,14 @@ namespace DualScreenDemo
{ {
OverlayForm.MainForm.Invoke(new System.Action(() => OverlayForm.MainForm.Invoke(new System.Action(() =>
{ {
OverlayForm.DisplayNumberAtTopLeft(number); OverlayForm.MainForm.HideTopRightLabels();
OverlayForm.MainForm.HideAllLabels(); OverlayForm.DisplayNumberAtTopLeft(number);
})); }));
} }
else else
{ {
OverlayForm.MainForm.HideTopRightLabels();
OverlayForm.DisplayNumberAtTopLeft(number); OverlayForm.DisplayNumberAtTopLeft(number);
OverlayForm.MainForm.HideAllLabels();
} }
} }
} }

View File

@ -60,9 +60,9 @@ namespace DBObj
} }
private string FindExistingPath(string filename) private string FindExistingPath(string filename)
{ {
var servers = new[] { @"\\svr01\", @"\\svr02\", @"\\svr01\e", @"\\svr02\e" }; foreach (var server in Utils.Env.GetSongServers())
foreach (var server in servers)
{ {
Console.WriteLine($"伺服器路徑: '{server}'");
string fullPath = Path.Combine(server, filename); string fullPath = Path.Combine(server, filename);
if (File.Exists(fullPath)) return fullPath; if (File.Exists(fullPath)) return fullPath;
} }

View File

@ -84,8 +84,8 @@ namespace DBObj
public static void UpdateNextSongLabel() public static void UpdateNextSongLabel()
{ {
VideoPlayerForm.overlayForm.UpdateNextSongLabel( VideoPlayerForm.overlayForm.UpdateTopLeftLabel(
(not_played.Count > 0) ? not_played[0].next_artist_text() : "目前沒有下一首,請踴躍點歌!!!" (not_played.Count > 0) ? not_played[0].getName() : "目前沒有下一首,請踴躍點歌!!!"
); );
} }
public static void clearSong() public static void clearSong()

7
Env.cs
View File

@ -49,6 +49,13 @@ namespace Utils
Console.WriteLine("所有指定目錄都找不到 config.ini"); Console.WriteLine("所有指定目錄都找不到 config.ini");
} }
public static string[] GetSongServers()
{
return Get("songServer", "")
.Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries)
.Select(s => s.Trim('\'', '"').TrimEnd('\\')) // 清理
.ToArray();
}
public static string Get(string key, string fallback = "") => public static string Get(string key, string fallback = "") =>
_values.TryGetValue(key, out var value) ? value : fallback; _values.TryGetValue(key, out var value) ? value : fallback;

View File

@ -451,24 +451,16 @@ namespace DualScreenDemo
break; break;
case "volume_up": case "volume_up":
// 执行音量增大操作 // 执行音量增大操作
PrimaryForm.SendCommandThroughSerialPort("a2 b3 a4");
OverlayForm.MainForm.Invoke(new System.Action(() => OverlayForm.MainForm.Invoke(new System.Action(() =>
{ {
OverlayForm.MainForm.ShowVolumeUpLabel(); OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↑","a2 b3 a4");
PrimaryForm.Instance.volumeUpTimer.Start();
OverlayForm.MainForm.HideAllLabels();
PrimaryForm.Instance.volumeUpTimer.Stop();
})); }));
break; break;
case "mic_up": case "mic_up":
// 执行麦克风增大操作 // 执行麦克风增大操作
PrimaryForm.SendCommandThroughSerialPort("a2 b5 a4");
OverlayForm.MainForm.Invoke(new System.Action(() => OverlayForm.MainForm.Invoke(new System.Action(() =>
{ {
OverlayForm.MainForm.ShowMicUpLabel(); OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↑","a2 b5 a4");
PrimaryForm.Instance.micControlTimer.Start();
OverlayForm.MainForm.HideAllLabels();
PrimaryForm.Instance.micControlTimer.Stop();
})); }));
break; break;
case "mute": case "mute":
@ -496,24 +488,16 @@ namespace DualScreenDemo
break; break;
case "volume_down": case "volume_down":
// 执行音量减小操作 // 执行音量减小操作
PrimaryForm.SendCommandThroughSerialPort("a2 b4 a4");
OverlayForm.MainForm.Invoke(new System.Action(() => OverlayForm.MainForm.Invoke(new System.Action(() =>
{ {
OverlayForm.MainForm.ShowVolumeDownLabel(); OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↓","a2 b4 a4");
PrimaryForm.Instance.volumeDownTimer.Start();
OverlayForm.MainForm.HideAllLabels();
PrimaryForm.Instance.volumeDownTimer.Stop();
})); }));
break; break;
case "mic_down": case "mic_down":
// 执行麦克风减小操作 // 执行麦克风减小操作
PrimaryForm.SendCommandThroughSerialPort("a2 b6 a4");
OverlayForm.MainForm.Invoke(new System.Action(() => OverlayForm.MainForm.Invoke(new System.Action(() =>
{ {
OverlayForm.MainForm.ShowMicDownLabel(); OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↓","a2 b6 a4");
PrimaryForm.Instance.micControlTimer.Start();
OverlayForm.MainForm.HideAllLabels();
PrimaryForm.Instance.micControlTimer.Stop();
})); }));
break; break;
case "original_song": case "original_song":
@ -533,12 +517,9 @@ namespace DualScreenDemo
break; break;
case "service": case "service":
// 执行服务操作 // 执行服务操作
PrimaryForm.SendCommandThroughSerialPort("a2 53 a4");
OverlayForm.MainForm.Invoke(new System.Action(() => { OverlayForm.MainForm.Invoke(new System.Action(() => {
OverlayForm.MainForm.ShowServiceBell(); OverlayForm.MainForm.ShowTopRightLabel("服務鈴","a2 53 a4");
})); }));
// 异步处理等待和隐藏标签
await HttpServer.HandleServiceBellAsync();
break; break;
case "replay": case "replay":
// 执行重唱操作 // 执行重唱操作
@ -551,9 +532,9 @@ namespace DualScreenDemo
break; break;
case "male_key": case "male_key":
// 执行男调操作 // 执行男调操作
OverlayForm.MainForm.Invoke(new System.Action(() => { //OverlayForm.MainForm.Invoke(new System.Action(() => {
OverlayForm.MainForm.ShowMaleKeyLabel(); // OverlayForm.MainForm.ShowTopRightLabelTime(" 男調 ");
})); //}));
if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen) if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen)
{ {
// 假設 0xA2, 0xC1, 0xA4 是升調的指令 // 假設 0xA2, 0xC1, 0xA4 是升調的指令
@ -571,9 +552,9 @@ namespace DualScreenDemo
break; break;
case "female_key": case "female_key":
// 执行女调操作 // 执行女调操作
OverlayForm.MainForm.Invoke(new System.Action(() => { //OverlayForm.MainForm.Invoke(new System.Action(() => {
OverlayForm.MainForm.ShowFemaleKeyLabel(); // OverlayForm.MainForm.ShowTopRightLabelTime(" 女調 ");
})); //}));
if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen) if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen)
{ {
// 假設 0xA2, 0xC1, 0xA4 是升調的指令 // 假設 0xA2, 0xC1, 0xA4 是升調的指令
@ -599,7 +580,7 @@ namespace DualScreenDemo
case "lower_key": case "lower_key":
// 执行降调操作 // 执行降调操作
OverlayForm.MainForm.Invoke(new System.Action(() => { OverlayForm.MainForm.Invoke(new System.Action(() => {
OverlayForm.MainForm.ShowKeyDownLabel(); OverlayForm.MainForm.ShowTopRightLabelTime("降 1# 調");
})); }));
// MessageBox.Show("降調功能啟動"); // MessageBox.Show("降調功能啟動");
@ -618,7 +599,7 @@ namespace DualScreenDemo
case "standard_key": case "standard_key":
// 执行标准调操作 // 执行标准调操作
OverlayForm.MainForm.Invoke(new System.Action(() => { OverlayForm.MainForm.Invoke(new System.Action(() => {
OverlayForm.MainForm.ShowStandardKeyLabel(); OverlayForm.MainForm.ShowTopRightLabelTime(" 標準調 ");
})); }));
if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen) if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen)
{ {
@ -635,7 +616,7 @@ namespace DualScreenDemo
case "raise_key": case "raise_key":
// 执行升调操作 // 执行升调操作
OverlayForm.MainForm.Invoke(new System.Action(() => { OverlayForm.MainForm.Invoke(new System.Action(() => {
OverlayForm.MainForm.ShowKeyUpLabel(); OverlayForm.MainForm.ShowTopRightLabelTime("升 1# 調");
})); }));
// MessageBox.Show("升調功能啟動"); // MessageBox.Show("升調功能啟動");
@ -675,13 +656,6 @@ namespace DualScreenDemo
await context.Response.OutputStream.WriteAsync(new byte[0], 0, 0); await context.Response.OutputStream.WriteAsync(new byte[0], 0, 0);
} }
} }
private static async Task HandleServiceBellAsync()
{
await Task.Delay(3000); // 等待 3 秒
OverlayForm.MainForm.Invoke(new System.Action(() => {
OverlayForm.MainForm.HideServiceBellLabel();
}));
}
private static async Task HandleOrderSongListRequest(HttpListenerContext context) private static async Task HandleOrderSongListRequest(HttpListenerContext context)
{ {
string jsonResponse = "{\"status\": \"error\", \"message\": \"An error occurred\"}"; string jsonResponse = "{\"status\": \"error\", \"message\": \"An error occurred\"}";

View File

@ -11,44 +11,9 @@ namespace OverlayFormObj
private List<Label> displayLabels; private List<Label> displayLabels;
public Label pauseLabel; public Label pauseLabel;
public Label muteLabel; // New mute label public Label muteLabel; // New mute label
public Label originalSongLabel; public Label topLeftLabel;
public Label nextSongLabel; public Label topRightLabel;
private Label serviceBellLabel; private System.Windows.Forms.Timer topRightTimer = new System.Windows.Forms.Timer();
private Label BellLabel;
private Label OriginalLabel;
public Label volumeUpLabel; // New volume up label
public Label volumeDownLabel; // New volume down label
private System.Windows.Forms.Timer BellTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer OriginalTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer volumeUpTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer volumeDownTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer micUpTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer micDownTimer = new System.Windows.Forms.Timer();
public Label micUpLabel; // New microphone up label
public Label micDownLabel; // New microphone down label
public Label keyUpLabel; // New key up label
public Label keyDownLabel; // New key down label
public Label standardLabel; // New standard label
public Label keyShiftLabel; // New keyShift label
public Label squareLabel; // New square label
public Label professionalLabel; // New professional label
public Label singDownLabel; // New sing down label
public Label brightLabel; // New bright label
public Label softLabel; // New soft label
public Label autoLabel; // New auto label
public Label romanticLabel; // New romantic label
public Label dynamicLabel; // New dynamic label
public Label tintLabel; // New tint label
private System.Windows.Forms.Timer standardTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer squareTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer professionalTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer singDownTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer brightTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer softTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer autoTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer romanticTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer dynamicTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer tintTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer secondLineDisplayTimer = new System.Windows.Forms.Timer(); private System.Windows.Forms.Timer secondLineDisplayTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer qrCodeTimer = new System.Windows.Forms.Timer(); private System.Windows.Forms.Timer qrCodeTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer delayTimer = new System.Windows.Forms.Timer(); private System.Windows.Forms.Timer delayTimer = new System.Windows.Forms.Timer();
@ -58,38 +23,11 @@ namespace OverlayFormObj
{ {
InitializeBlackBackgroundPanel(); InitializeBlackBackgroundPanel();
InitializeDisplayLabel(); InitializeDisplayLabel();
// InitializeSongDisplayLabel();
InitializeDisplayLabels(); InitializeDisplayLabels();
InitializePauseLabel(); InitializePauseLabel();
InitializeMuteLabel(); // Initialize the new mute label InitializeMuteLabel(); // Initialize the new mute label
InitializeOriginalSongLabel(); // 初始化原唱标签 InitializeTopRightLabel();
InitializeServiceBellLabel(); InitializeTopLeftLabel();
InitializeBellLabel();
InitializeOriginalLabel();
InitializeVolumeUpLabel(); // Initialize the volume up label
InitializeVolumeDownLabel(); // Initialize the volume down label
InitializeMicUpLabel(); // Initialize the microphone up label
InitializeMicDownLabel(); // Initialize the microphone down label
InitializeKeyUpLabel(); // Initialize the key up label
InitializeKeyDownLabel(); // Initialize the key down label
InitializeStandardLabel(); // Initialize the standard label
InitializeSquareLabel(); // Initialize the square label
InitializeProfessionalLabel(); // Initialize the professional label
InitializeSingDownLabel(); // Initialize the sing down label
InitializeBrightLabel(); // Initialize the bright label
InitializeSoftLabel(); // Initialize the soft label
InitializeAutoLabel(); // Initialize the auto label
InitializeRomanticLabel(); // Initialize the romantic label
InitializeDynamicLabel(); // Initialize the dynamic label
InitializeTintLabel(); // Initialize the tint label
InitializeStandardKeyLabel();
InitializeMaleKeyLabel();
InitializeMaleKeyTimer();
InitializeFemaleKeyLabel();
InitializeNextSongLabel();
InitializeFemaleKeyTimer();
ConfigureKeyTimers(); ConfigureKeyTimers();
InitializemessageLabel(); InitializemessageLabel();
} }
@ -97,59 +35,11 @@ namespace OverlayFormObj
private void ConfigureKeyTimers() private void ConfigureKeyTimers()
{ {
OriginalTimer.Interval = 1000;
OriginalTimer.Tick += (sender, e) => {OriginalLabel.Visible = false;OriginalTimer.Stop();keepshowmic();};
BellTimer.Interval = 1000;
BellTimer.Tick += (sender, e) => {BellLabel.Visible = false;BellTimer.Stop();keepshowmic();};
volumeUpTimer.Interval = 1000;
volumeUpTimer.Tick += (sender, e) => {volumeUpLabel.Visible = false;volumeUpTimer.Stop();keepshowmic();};
volumeDownTimer.Interval = 1000;
volumeDownTimer.Tick += (sender, e) => {volumeDownLabel.Visible = false;volumeDownTimer.Stop();keepshowmic();};
maleKeyTimer.Interval = 1000;
maleKeyTimer.Tick += (sender, e) => {maleKeyLabel.Visible = false;maleKeyTimer.Stop();keepshowmic();};
femaleKeyTimer.Interval = 1000;
femaleKeyTimer.Tick += (sender, e) => {femaleKeyLabel.Visible = false;femaleKeyTimer.Stop();keepshowmic();};
micUpTimer.Interval = 1000;
micUpTimer.Tick += (sender, e) => {micUpLabel.Visible = false;micUpTimer.Stop();keepshowmic();};
micDownTimer.Interval =1000;
micDownTimer.Tick += (sender, e) =>{micDownLabel.Visible = false;micDownTimer.Stop();keepshowmic();};
brightTimer.Interval = 1000;
brightTimer.Tick += (sender, e) => {brightLabel.Visible = false;brightTimer.Stop();keepshowmic();};
softTimer.Interval = 1000;
softTimer.Tick += (sender, e) => {softLabel.Visible = false;softTimer.Stop();keepshowmic();};
autoTimer.Interval = 1000;
autoTimer.Tick += (sender, e) => {autoLabel.Visible = false;autoTimer.Stop();keepshowmic();};
romanticTimer.Interval = 1000;
romanticTimer.Tick += (sender, e) => {romanticLabel.Visible = false;romanticTimer.Stop();keepshowmic();};
dynamicTimer.Interval = 1000;
dynamicTimer.Tick += (sender, e) => {dynamicLabel.Visible = false;dynamicTimer.Stop();keepshowmic();};
tintTimer.Interval = 1000;
tintTimer.Tick += (sender, e) => {tintLabel.Visible = false;tintTimer.Stop();keepshowmic();};
standardKeyTimer.Interval = 1000;
standardKeyTimer.Tick += (sender, e) => {standardKeyLabel.Visible = false;standardKeyTimer.Stop();keepshowmic();};
messageTimer.Interval = 5000; messageTimer.Interval = 5000;
messageTimer.Tick += (sender, e) => {messageLabel.Visible = false;messageTimer.Stop();keepshowmic();}; messageTimer.Tick += (sender, e) => {messageLabel.Visible = false;messageTimer.Stop();RedisplayTopRigthLabel();};
keyUpTimer.Interval = 1000; topRightTimer.Interval = 1000;
keyUpTimer.Tick += (sender, e) => {keyUpLabel.Visible = false;keyUpTimer.Stop();keepshowmic();}; topRightTimer.Tick += (sender, e) => { topRightLabel.Visible = false; topRightTimer.Stop(); RedisplayTopRigthLabel(); };
keyDownTimer.Interval = 1000;
keyDownTimer.Tick += (sender, e) => {keyDownLabel.Visible = false;keyDownTimer.Stop();keepshowmic();};
secondLineDisplayTimer.Interval = 32000; secondLineDisplayTimer.Interval = 32000;
secondLineDisplayTimer.Tick += SecondLineDisplayTimer_Tick; secondLineDisplayTimer.Tick += SecondLineDisplayTimer_Tick;
@ -170,20 +60,6 @@ namespace OverlayFormObj
{ {
try try
{ {
// Read the server address from the file
string serverAddressFilePath = Path.Combine(Application.StartupPath, "txt", "ip.txt");
if (!File.Exists(serverAddressFilePath))
{
Console.WriteLine("Server address file not found: " + serverAddressFilePath);
return;
}
string serverAddress = File.ReadAllText(serverAddressFilePath).Trim();
// Generate the URL content for the QR code
string qrContent = serverAddress.Contains(":") ?
String.Format("http://{0}/{1}/windows.html", serverAddress, randomFolderPath) :
String.Format("http://{0}:{1}/{2}/windows.html", serverAddress, 9090, randomFolderPath);
// Console.WriteLine("QR Content: " + qrContent);
string qrImagePath = Path.Combine(Application.StartupPath, "themes/superstar/_www", randomFolderPath, "qrcode.png"); string qrImagePath = Path.Combine(Application.StartupPath, "themes/superstar/_www", randomFolderPath, "qrcode.png");
if (!File.Exists(qrImagePath)) if (!File.Exists(qrImagePath))
{ {
@ -374,136 +250,6 @@ namespace OverlayFormObj
}; };
this.Controls.Add(muteLabel); this.Controls.Add(muteLabel);
} }
private void InitializeServiceBellLabel()
{
serviceBellLabel = new Label
{
Text = " 服務鈴 ",
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
ForeColor = Color.White,
BackColor = Color.Black,
AutoSize = true,
Visible = false // 初始设置为不可见
};
serviceBellLabel.PerformLayout();
// Console.WriteLine($"初始化标签位置: {serviceBellLabel.Location}, 大小: {serviceBellLabel.Size}");
serviceBellLabel.BringToFront();
this.Controls.Add(serviceBellLabel);
this.Resize += (s, e) =>
{
serviceBellLabel.Location = new Point(this.Width - serviceBellLabel.Width - 10,56);
// Console.WriteLine($"调整标签位置: {serviceBellLabel.Location}, 大小: {serviceBellLabel.Size}");
};
}
private void InitializeOriginalSongLabel()
{
originalSongLabel = new Label
{
Text = "有人聲",
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold), // 设置字体样式
ForeColor = Color.White , // 设置文字颜色
BackColor = Color.Black,
AutoSize = true,
Visible = false // 初始设置为不可见
};
this.Controls.Add(originalSongLabel);
this.Resize += (s, e) =>
{
originalSongLabel.Location = new Point(this.Width - originalSongLabel.Width - 10, 56);
};
}
private void InitializeVolumeUpLabel()
{
volumeUpLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent,
Text = "音量 ↑",
Visible = false
};
blackBackgroundPanel.Controls.Add(volumeUpLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
volumeUpLabel.Location = new Point(blackBackgroundPanel.Width - volumeUpLabel.Width - 10, 56);
};
}
private void InitializeOriginalLabel()
{
OriginalLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent,
Text = "有人聲",
Visible = false
};
blackBackgroundPanel.Controls.Add(OriginalLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
OriginalLabel.Location = new Point(blackBackgroundPanel.Width - OriginalLabel.Width - 10, 56);
};
}
private void InitializeBellLabel()
{
BellLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent,
Text = "服務鈴",
Visible = false
};
blackBackgroundPanel.Controls.Add(BellLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
BellLabel.Location = new Point(blackBackgroundPanel.Width - BellLabel.Width - 10, 56);
};
}
private void InitializeVolumeDownLabel()
{
volumeDownLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent,
Text = "音量 ↓",
Visible = false
};
blackBackgroundPanel.Controls.Add(volumeDownLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
volumeDownLabel.Location = new Point(blackBackgroundPanel.Width - volumeDownLabel.Width - 10, 56);
};
}
private void InitializeMicUpLabel()
{
micUpLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent,
Text = "麥克風 ↑",
Visible = false
};
blackBackgroundPanel.Controls.Add(micUpLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
micUpLabel.Location = new Point(blackBackgroundPanel.Width - micUpLabel.Width - 10, 56);
};
}
public Panel blackBackgroundPanel; public Panel blackBackgroundPanel;
private void InitializeBlackBackgroundPanel() private void InitializeBlackBackgroundPanel()
@ -562,30 +308,9 @@ namespace OverlayFormObj
blackBackgroundPanel.SendToBack(); blackBackgroundPanel.SendToBack();
} }
private void InitializeTopLeftLabel()
private void InitializeMicDownLabel()
{ {
topLeftLabel = new Label
micDownLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent,
Text = "麥克風 ↓",
Visible = false
};
blackBackgroundPanel.Controls.Add(micDownLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
micDownLabel.Location = new Point(blackBackgroundPanel.Width - micDownLabel.Width - 15, 56);
};
}
private void InitializeNextSongLabel()
{
nextSongLabel = new Label
{ {
AutoSize = true, AutoSize = true,
ForeColor = Color.White, ForeColor = Color.White,
@ -594,556 +319,87 @@ namespace OverlayFormObj
Text = "", Text = "",
Visible = true Visible = true
}; };
blackBackgroundPanel.Controls.Add(nextSongLabel); blackBackgroundPanel.Controls.Add(topLeftLabel);
nextSongLabel.Location = new Point(10, 56); topLeftLabel.Location = new Point(10, 56);
} }
// 更新 nextSongLabel 標籤的文本 // 更新 nextSongLabel 標籤的文本
public void UpdateNextSongLabel(string text) public void UpdateTopLeftLabel(string text)
{ {
if (nextSongLabel == null) if (topLeftLabel == null)
{ {
return; return;
} }
nextSongLabel.Text = text; topLeftLabel.Text = text;
nextSongLabel.Visible = true; // 確保標籤顯示 topLeftLabel.Visible = true; // 確保標籤顯示
Console.WriteLine($"更新顯示: {text}"); Console.WriteLine($"更新顯示: {text}");
} }
private void InitializeKeyUpLabel() private void InitializeTopRightLabel()
{ {
keyUpLabel = new Label(); topRightLabel = new Label
keyUpLabel.AutoSize = true;
keyUpLabel.ForeColor = Color.White;
keyUpLabel.Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold); // 设置字体样式
keyUpLabel.BackColor = Color.Black;
keyUpLabel.Text = "升調 1# ";
keyUpLabel.Visible = false; // 初始设置为不可见
this.Controls.Add(keyUpLabel);
this.Resize += (s, e) =>
{
keyUpLabel.Location = new Point(this.Width - keyUpLabel.Width - 10, 56);
};
}
// Initialize the key down label
private void InitializeKeyDownLabel()
{
keyDownLabel = new Label();
keyDownLabel.AutoSize = true;
keyDownLabel.ForeColor = Color.White;
keyDownLabel.Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold); // 设置字体样式
keyDownLabel.BackColor = Color.Black;
keyDownLabel.Text = "降調 1# ";
keyDownLabel.Visible = false;
this.Controls.Add(keyDownLabel);
this.Resize += (s, e) =>
{
keyDownLabel.Location = new Point(this.Width - keyDownLabel.Width - 10 ,56);
};
}
private void InitializeStandardLabel()
{
standardLabel = new Label
{ {
AutoSize = true, AutoSize = true,
ForeColor = Color.White, ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold), Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent, BackColor = Color.Transparent,
Text = "標準迴音", Text = "標準迴音",
Visible = false Visible = true
}; };
blackBackgroundPanel.Controls.Add(standardLabel); blackBackgroundPanel.Controls.Add(topRightLabel);
blackBackgroundPanel.Resize += (s, e) => blackBackgroundPanel.Resize += (s, e) =>
{ {
standardLabel.Location = new Point(blackBackgroundPanel.Width - standardLabel.Width - 10, 56); topRightLabel.Location = new Point(blackBackgroundPanel.Width - topRightLabel.Width - 10, 56);
}; };
} }
private void InitializeSquareLabel()
{
squareLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent,
Text = "廣場迴音",
Visible = false
};
blackBackgroundPanel.Controls.Add(squareLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
squareLabel.Location = new Point(blackBackgroundPanel.Width - squareLabel.Width - 10, 56);
};
}
private void InitializeProfessionalLabel()
{
professionalLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent,
Text = "專業迴音",
Visible = false
};
blackBackgroundPanel.Controls.Add(professionalLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
professionalLabel.Location = new Point(blackBackgroundPanel.Width - professionalLabel.Width - 10, 56);
};
}
private void InitializeSingDownLabel()
{
singDownLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent,
Text = "唱將迴音",
Visible = false
};
blackBackgroundPanel.Controls.Add(singDownLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
singDownLabel.Location = new Point(blackBackgroundPanel.Width - singDownLabel.Width - 10, 56);
};
}
private void InitializeBrightLabel()
{
brightLabel = new Label();
brightLabel.AutoSize = true;
brightLabel.ForeColor = Color.LightYellow;
brightLabel.Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold); // 设置字体样式
brightLabel.BackColor = Color.Transparent;
brightLabel.Text = " 明亮 ";
brightLabel.Visible = false; // 初始设置为不可见
this.Controls.Add(brightLabel);
this.Resize += (s, e) =>
{
brightLabel.Location = new Point(this.Width - brightLabel.Width - 10, 27);
};
}
private void InitializeSoftLabel()
{
softLabel = new Label();
softLabel.AutoSize = true;
softLabel.ForeColor = Color.LightGreen;
softLabel.Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold); // 设置字体样式
softLabel.BackColor = Color.Transparent;
softLabel.Text = " 柔和 ";
softLabel.Visible = false; // 初始设置为不可见
this.Controls.Add(softLabel);
this.Resize += (s, e) =>
{
softLabel.Location = new Point(this.Width - softLabel.Width - 10,27);
};
}
// Initialize the auto label
private void InitializeAutoLabel()
{
autoLabel = new Label();
autoLabel.AutoSize = true;
autoLabel.ForeColor = Color.Cyan;
autoLabel.Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold); // 设置字体样式
autoLabel.BackColor = Color.Transparent;
autoLabel.Text = " 自動 ";
autoLabel.Visible = false; // 初始设置为不可见
this.Controls.Add(autoLabel);
this.Resize += (s, e) =>
{
autoLabel.Location = new Point(this.Width - autoLabel.Width - 10, 27);
};
}
private void InitializeRomanticLabel()
{
romanticLabel = new Label();
romanticLabel.AutoSize = true;
romanticLabel.ForeColor = Color.Pink;
romanticLabel.Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold); // 设置字体样式
romanticLabel.BackColor = Color.Transparent;
romanticLabel.Text = " 浪漫 ";
romanticLabel.Visible = false;
this.Controls.Add(romanticLabel);
this.Resize += (s, e) =>
{
romanticLabel.Location = new Point(this.Width - romanticLabel.Width - 10, 27);
};
}
private void InitializeDynamicLabel()
{
dynamicLabel = new Label();
dynamicLabel.AutoSize = true;
dynamicLabel.ForeColor = Color.Red;
dynamicLabel.Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold); // 设置字体样式
dynamicLabel.BackColor = Color.Transparent;
dynamicLabel.Text = " 動感 ";
dynamicLabel.Visible = false; // 初始设置为不可见
this.Controls.Add(dynamicLabel);
this.Resize += (s, e) =>
{
dynamicLabel.Location = new Point(this.Width - dynamicLabel.Width - 10, 27);
};
}
// Initialize the tint label
private void InitializeTintLabel()
{
tintLabel = new Label();
tintLabel.AutoSize = true;
tintLabel.ForeColor = Color.Blue;
tintLabel.Font = new Font("Microsoft JhengHei",34, FontStyle.Bold); // 设置字体样式
tintLabel.BackColor = Color.Transparent;
tintLabel.Text = " 調色 ";
tintLabel.Visible = false;
this.Controls.Add(tintLabel);
this.Resize += (s, e) =>
{
tintLabel.Location = new Point(this.Width - tintLabel.Width - 10, 27);
};
}
// 显示服务铃标签
public void ShowServiceBellLabel()
{
whichoneshowmic();
HideAllLabels();
serviceBellLabel.Visible = true;
Console.WriteLine("服務鈴顯示: " + serviceBellLabel.Text); // 输出标签文本内容
}
public void HideServiceBellLabel()
{ /*
serviceBellLabel.Visible = false;
Console.WriteLine("服務鈴隱藏: " + serviceBellLabel.Text); // 输出标签文本内容
keepshowmic();
*/
}
// 显示标准标签 // 显示标准标签
public void ShowStandardLabel()
{
HideAllLabels();
standardLabel.Visible = true;
whichoneshowmic();
standardTimer.Start();
}
public void ShowSquareLabel()
{
HideAllLabels();
squareLabel.Visible = true;
whichoneshowmic();
squareTimer.Start();
}
public void ShowProfessionalLabel() public void ShowPauseLabel() => pauseLabel.Visible = true;
{
HideAllLabels();
professionalLabel.Visible = true;
whichoneshowmic();
professionalTimer.Start();
}
// 显示唱將标签
public void ShowSingDownLabel()
{
HideAllLabels();
singDownLabel.Visible = true;
whichoneshowmic();
singDownTimer.Start();
}
// 显示明亮标签
public void ShowBrightLabel()
{
HideAllLabels();
brightLabel.Visible = true;
whichoneshowmic();
brightTimer.Start();
}
// 显示柔和标签
public void ShowSoftLabel()
{
HideAllLabels();
softLabel.Visible = true;
whichoneshowmic();
softTimer.Start();
}
public void ShowAutoLabel()
{
HideAllLabels();
autoLabel.Visible = true;
whichoneshowmic();
autoTimer.Start();
}
// 显示浪漫标签
public void ShowRomanticLabel()
{
HideAllLabels();
romanticLabel.Visible = true;
whichoneshowmic();
romanticTimer.Start();
}
public void ShowDynamicLabel()
{
HideAllLabels();
dynamicLabel.Visible = true;
whichoneshowmic();
dynamicTimer.Start();
}
public void ShowTintLabel()
{
HideAllLabels();
tintLabel.Visible = true;
whichoneshowmic();
tintTimer.Start();
}
private void InitializeStandardKeyLabel()
{
standardKeyLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Black,
Text = " 標準調 ",
Visible = false
};
blackBackgroundPanel.Controls.Add(standardKeyLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
standardKeyLabel.Location = new Point(blackBackgroundPanel.Width - standardKeyLabel.Width - 10, 56);
};
}
private void InitializeFemaleKeyLabel()
{
femaleKeyLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent,
Text = " 女調 ",
Visible = false
};
blackBackgroundPanel.Controls.Add(femaleKeyLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
femaleKeyLabel.Location = new Point(blackBackgroundPanel.Width - femaleKeyLabel.Width - 10, 56);
};
}
private void InitializeMaleKeyLabel()
{
maleKeyLabel = new Label
{
AutoSize = true,
ForeColor = Color.White,
Font = new Font("Microsoft JhengHei", 34, FontStyle.Bold),
BackColor = Color.Transparent,
Text = " 男調 ",
Visible = false
};
blackBackgroundPanel.Controls.Add(maleKeyLabel);
blackBackgroundPanel.Resize += (s, e) =>
{
maleKeyLabel.Location = new Point(blackBackgroundPanel.Width - maleKeyLabel.Width - 10, 56);
};
}
public void ShowPauseLabel()
{
pauseLabel.Visible = true;
}
// 隐藏暂停标签 // 隐藏暂停标签
public void HidePauseLabel() public void HidePauseLabel() => pauseLabel.Visible = false;
{
pauseLabel.Visible = false;
}
// 显示静音标签 // 显示静音标签
public void ShowMuteLabel() public void ShowMuteLabel() => muteLabel.Visible = true;
{
muteLabel.Visible = true;
}
// 隐藏静音标签 // 隐藏静音标签
public void HideMuteLabel() public void HideMuteLabel() => muteLabel.Visible = false;
public void ShowTopRightLabel(string customText = "",string tag =null)
{ {
muteLabel.Visible = false; if (tag != null)
}
public void ShowOriginalSongLabel(string text="有人聲")
{
HideAllLabels();
originalSongLabel.Text = text;
originalSongLabel.Visible = true;
}
public void HideOriginalSongLabel()
{
originalSongLabel.Visible = false;
keepshowmic();
}
public void ToggleOriginalSongLabel()
{
originalSongLabel.Visible = !originalSongLabel.Visible;
}
public void ShowMaleKeyLabel()
{
maleKeyLabel.Visible = true;
maleKeyTimer.Start();
}
public void ShowFemaleKeyLabel()
{
femaleKeyLabel.Visible = true;
femaleKeyTimer.Start();
}
public void ShowVolumeUpLabel()
{
volumeUpLabel.Visible = true;
volumeUpTimer.Start();
}
public void ShowServiceBell()
{
BellLabel.Visible = true;
BellTimer.Start();
}
public void ShowOriginalLabel(string text = "有人聲")
{
OriginalLabel.Text = text;
OriginalLabel.Visible = true;
OriginalTimer.Start();
}
// 显示音量-标签
public void ShowVolumeDownLabel()
{
volumeDownLabel.Visible = true;
volumeDownTimer.Start();
}
// 显示麥克風+标签
public void ShowMicUpLabel()
{
micUpLabel.Visible = true;
micUpTimer.Start();
}
// 显示麥克風-标签
public void ShowMicDownLabel()
{
micDownLabel.Visible = true;
micDownTimer.Start();
}
// 显示標準調标签
public void ShowStandardKeyLabel()
{
standardKeyLabel.Visible = true;
standardKeyTimer.Start();
}
public void ShowKeyUpLabel(string customText = "")
{
// keyUpLabel.Text = string.IsNullOrWhiteSpace(customText) ? "升 1# 調" : customText;
keyUpLabel.Text = customText;
keyUpLabel.Visible = true;
keyUpTimer.Start();
}
public void ShowKeyDownLabel(string customText = "")
{
keyDownLabel.Text = customText;
keyDownLabel.Visible = true;
keyDownTimer.Start();
}
private string switchmic = "Standard" ;
// 隐藏所有标签
public void HideAllLabels()
{
HidemicLabels();
}
public void whichoneshowmic()
{
if(singDownLabel.Visible){
switchmic="SingDown";
}else if(professionalLabel.Visible){
switchmic="Professional";
}else if(squareLabel.Visible){
switchmic="Square";
}else if(standardLabel.Visible){
switchmic="Standard";
}
}
public void keepshowmic()
{
switch (switchmic)
{ {
case "SingDown": PrimaryForm.SendCommandThroughSerialPort(tag);
HidemicLabels();
ShowSingDownLabel();
break;
case "Professional":
HidemicLabels();
ShowProfessionalLabel();
break;
case "Square":
HidemicLabels();
ShowSquareLabel();
break;
case "Standard":
HidemicLabels();
ShowStandardLabel();
break;
default:
break;
} }
HideTopRightLabels();
topRightLabel.Text = customText;
topRightLabel.Visible = true;
} }
public void ShowTopRightLabelTime(string customText = "",string tag =null)
public void HidemicLabels()
{ {
singDownLabel.Visible = false; ShowTopRightLabel(customText, tag);
singDownTimer.Stop(); topRightTimer.Stop();
professionalLabel.Visible = false; topRightTimer.Start();
professionalTimer.Stop(); }
squareLabel.Visible = false; public void ShowTopRightEchoLabel(string customText = "")
squareTimer.Stop(); {
standardLabel.Visible = false; switchmic = customText;
standardTimer.Stop(); ShowTopRightLabel(customText);
}
private string switchmic = "標準迴音";
// 隐藏所有标签
public void HideTopRightLabels()
{
topRightLabel.Visible = false;
}
public void RedisplayTopRigthLabel()
{
HideTopRightLabels();
ShowTopRightEchoLabel(switchmic);
} }
private void InitializemessageLabel() private void InitializemessageLabel()
{ {

View File

@ -29,16 +29,8 @@ namespace OverlayFormObj
public static System.Timers.Timer unifiedTimer; public static System.Timers.Timer unifiedTimer;
private System.Windows.Forms.Timer stickerTimer1 = new System.Windows.Forms.Timer(); private System.Windows.Forms.Timer stickerTimer1 = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer stickerTimer2 = new System.Windows.Forms.Timer(); private System.Windows.Forms.Timer stickerTimer2 = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer keyUpTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer keyDownTimer = new System.Windows.Forms.Timer();
public Label standardKeyLabel;
private System.Windows.Forms.Timer standardKeyTimer = new System.Windows.Forms.Timer();
private System.Windows.Forms.Timer messageTimer = new System.Windows.Forms.Timer(); private System.Windows.Forms.Timer messageTimer = new System.Windows.Forms.Timer();
public Label maleKeyLabel;
public Label messageLabel; public Label messageLabel;
private System.Windows.Forms.Timer maleKeyTimer;
public Label femaleKeyLabel;
private System.Windows.Forms.Timer femaleKeyTimer;
private System.Windows.Forms.Timer secondLineTimer; private System.Windows.Forms.Timer secondLineTimer;
private DateTime secondLineStartTime; private DateTime secondLineStartTime;
private const int secondLineDuration = 20000; private const int secondLineDuration = 20000;
@ -109,29 +101,6 @@ namespace OverlayFormObj
currentSegmentIndex = 0; currentSegmentIndex = 0;
} }
private void InitializeMaleKeyTimer()
{
maleKeyTimer = new System.Windows.Forms.Timer();
maleKeyTimer.Interval = 3000;
maleKeyTimer.Tick += (s, e) =>
{
HideAllLabels();
};
}
private void InitializeFemaleKeyTimer()
{
femaleKeyTimer = new System.Windows.Forms.Timer();
femaleKeyTimer.Interval = 3000;
femaleKeyTimer.Tick += (s, e) =>
{
HideAllLabels();
};
}
private void AddCenteredPicture(Bitmap bitmap, int y) private void AddCenteredPicture(Bitmap bitmap, int y)
{ {
int x = (this.Width - bitmap.Width) / 2; int x = (this.Width - bitmap.Width) / 2;
@ -296,7 +265,7 @@ namespace OverlayFormObj
{ {
string currentText = MainForm.displayLabel.Text; string currentText = MainForm.displayLabel.Text;
MainForm.nextSongLabel.Visible = false; MainForm.topLeftLabel.Visible = false;
string combinedText = currentText + newText; string combinedText = currentText + newText;
@ -308,7 +277,7 @@ namespace OverlayFormObj
MainForm.displayLabel.Text = combinedText; MainForm.displayLabel.Text = combinedText;
MainForm.nextSongLabel.Visible = false; MainForm.topLeftLabel.Visible = false;
displayTimer.Stop(); displayTimer.Stop();
@ -415,54 +384,51 @@ namespace OverlayFormObj
}; };
} }
private static void DisplayTimer_Tick(object sender, EventArgs e) private static void DisplayTimer_Tick(object sender, EventArgs e)
{
if (MainForm.InvokeRequired)
{
MainForm.Invoke(new System.Action(() =>
{ {
MainForm.displayLabel.Text = ""; if (MainForm.InvokeRequired)
MainForm.nextSongLabel.Visible = true; // 显示 nextSongLabel {
})); MainForm.Invoke(new System.Action(() =>
} {
else MainForm.displayLabel.Text = "";
{ MainForm.topLeftLabel.Visible = true; // 显示 topLeftLabel
MainForm.displayLabel.Text = ""; }));
MainForm.nextSongLabel.Visible = true; // 显示 nextSongLabel }
} else
{
MainForm.displayLabel.Text = "";
MainForm.topLeftLabel.Visible = true; // 显示 topLeftLabel
}
displayTimer.Stop(); // 停止计时器 displayTimer.Stop(); // 停止计时器
} }
// 當 songDisplayTimer 計時完成時會呼叫此函式 // 當 songDisplayTimer 計時完成時會呼叫此函式
private static void SongDisplayTimer_Elapsed(object sender, EventArgs e) private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
{
// 檢查是否需要跨執行緒操作 UI 控制項
if (MainForm.InvokeRequired)
{
// 如果目前不在 UI 執行緒上,必須透過 Invoke 安全執行 UI 更新邏輯
Console.WriteLine("SongDisplayTimer_Tick invoked on UI thread.");
MainForm.BeginInvoke(new Action(() =>
{ {
if (MainForm.songDisplayLabel != null) // 檢查是否需要跨執行緒操作 UI 控制項
MainForm.songDisplayLabel.Text = ""; if (MainForm.InvokeRequired)
{
// 如果目前不在 UI 執行緒上,必須透過 Invoke 安全執行 UI 更新邏輯
Console.WriteLine("SongDisplayTimer_Tick invoked on UI thread.");
if (MainForm.nextSongLabel != null) MainForm.BeginInvoke(new Action(() =>
MainForm.nextSongLabel.Visible = true; {
})); if (MainForm.topLeftLabel != null)
} MainForm.topLeftLabel.Visible = true;
else }));
{ }
// 如果已經在 UI 執行緒,就直接更新 UI 控制項 else
Console.WriteLine("SongDisplayTimer_Tick invoked on background thread."); {
MainForm.songDisplayLabel.Text = ""; // 如果已經在 UI 執行緒,就直接更新 UI 控制項
MainForm.nextSongLabel.Visible = true; Console.WriteLine("SongDisplayTimer_Tick invoked on background thread.");
} //MainForm.songDisplayLabel.Text = "";
MainForm.topLeftLabel.Visible = true;
}
// 停止計時器,避免重複觸發 // 停止計時器,避免重複觸發
songDisplayTimer.Stop(); songDisplayTimer.Stop();
} }
@ -514,7 +480,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
private void DisplayMessage(string message, int duration) private void DisplayMessage(string message, int duration)
{ {
MainForm.nextSongLabel.Visible = false; MainForm.topLeftLabel.Visible = false;
displayLabel.Text = message; displayLabel.Text = message;
unifiedTimer.Interval = duration; unifiedTimer.Interval = duration;
unifiedTimer.Start(); unifiedTimer.Start();
@ -554,27 +520,6 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
} }
} }
public void UpdateSongDisplayLabel(string newText)
{
songDisplayLabel.Text = newText;
songDisplayLabel.Font = new Font("Arial", 125);
songDisplayLabel.ForeColor = Color.White;
songDisplayTimer.Stop();
songDisplayTimer.Start();
this.Invalidate();
}
private void SecondLineTimer_Tick(object sender, EventArgs e) private void SecondLineTimer_Tick(object sender, EventArgs e)
{ {
if ((DateTime.Now - secondLineStartTime).TotalMilliseconds >= secondLineDuration) if ((DateTime.Now - secondLineStartTime).TotalMilliseconds >= secondLineDuration)
@ -793,7 +738,7 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
public static string ReadSongNumber() public static string ReadSongNumber()
{ {
string songNumber = MainForm.displayLabel.Text; string songNumber = MainForm.displayLabel.Text;
MainForm.nextSongLabel.Visible = false; MainForm.topLeftLabel.Visible = false;
return songNumber; return songNumber;
} }
@ -844,27 +789,9 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
if (control != MainForm.displayLabel && if (control != MainForm.displayLabel &&
control != MainForm.pauseLabel && control != MainForm.pauseLabel &&
control != MainForm.muteLabel && control != MainForm.muteLabel &&
control != MainForm.volumeUpLabel && control != MainForm.topRightLabel &&
control != MainForm.volumeDownLabel &&
control != MainForm.micUpLabel &&
control != MainForm.micDownLabel &&
control != MainForm.standardKeyLabel &&
control != MainForm.keyUpLabel &&
control != MainForm.keyDownLabel &&
control != MainForm.maleKeyLabel &&
control != MainForm.femaleKeyLabel &&
control != MainForm.squareLabel &&
control != MainForm.professionalLabel &&
control != MainForm.standardLabel &&
control != MainForm.singDownLabel &&
control != MainForm.brightLabel &&
control != MainForm.softLabel &&
control != MainForm.autoLabel &&
control != MainForm.romanticLabel &&
control != MainForm.dynamicLabel &&
control != MainForm.tintLabel &&
control != MainForm.blackBackgroundPanel && control != MainForm.blackBackgroundPanel &&
control != MainForm.nextSongLabel) control != MainForm.topLeftLabel)
{ {
MainForm.Controls.Remove(control); MainForm.Controls.Remove(control);
// control.Dispose(); // control.Dispose();
@ -1156,27 +1083,9 @@ private static void SongDisplayTimer_Elapsed(object sender, EventArgs e)
if (control != displayLabel && if (control != displayLabel &&
control != pauseLabel && control != pauseLabel &&
control != muteLabel && control != muteLabel &&
control != volumeUpLabel && control != topRightLabel &&
control != volumeDownLabel &&
control != micUpLabel &&
control != micDownLabel &&
control != standardKeyLabel &&
control != keyUpLabel &&
control != keyDownLabel &&
control != maleKeyLabel &&
control != femaleKeyLabel &&
control != squareLabel &&
control != professionalLabel &&
control != standardLabel &&
control != singDownLabel &&
control != brightLabel &&
control != softLabel &&
control != autoLabel &&
control != romanticLabel &&
control != dynamicLabel &&
control != tintLabel &&
control != blackBackgroundPanel && control != blackBackgroundPanel &&
control != nextSongLabel) control != topLeftLabel)
{ {
this.Controls.Remove(control); this.Controls.Remove(control);
control.Dispose(); control.Dispose();

View File

@ -20,23 +20,6 @@ namespace DualScreenDemo
using (Image baseImage = Image.FromFile(imagePath)) using (Image baseImage = Image.FromFile(imagePath))
{ {
string serverAddressFilePath = Path.Combine(Application.StartupPath, "txt", "ip.txt");
if (!File.Exists(serverAddressFilePath))
{
Console.WriteLine("Server address file not found: " + serverAddressFilePath);
return;
}
string serverAddress = File.ReadAllText(serverAddressFilePath).Trim();
// 根据地址格式生成不同的URL
string qrContent = serverAddress.Contains(":") ?
String.Format("http://{0}/{1}/windows.html", serverAddress, randomFolderPath) :
String.Format("http://{0}:{1}/{2}/windows.html", serverAddress, 9090, randomFolderPath);
// Console.WriteLine("QR Content: " + qrContent);
string qrImagePath = Path.Combine(Application.StartupPath, "themes/superstar/_www", randomFolderPath, "qrcode.png"); string qrImagePath = Path.Combine(Application.StartupPath, "themes/superstar/_www", randomFolderPath, "qrcode.png");
if (!File.Exists(qrImagePath)) if (!File.Exists(qrImagePath))
{ {

View File

@ -53,21 +53,17 @@ namespace DualScreenDemo
ConfigureButton(this.syncPauseButton, 1218, 475, 205, 56, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, SyncPauseButton_Click); ConfigureButton(this.syncPauseButton, 1218, 475, 205, 56, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, SyncPauseButton_Click);
ConfigureButton(this.syncPlayButton, 1218, 475, 205, 56, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, SyncPlayButton_Click); ConfigureButton(this.syncPlayButton, 1218, 475, 205, 56, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, SyncPlayButton_Click);
ConfigureButton(this.syncVolumeUpButton, 1218, 546, 205, 55, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, null); ConfigureButton(this.syncVolumeUpButton, 1218, 546, 205, 55, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, null);
this.syncVolumeUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowVolumeUpLabel(); volumeUpTimer.Start(); }; this.syncVolumeUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↑ ","a2 b3 a4"); };
this.syncVolumeUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.HideAllLabels(); volumeUpTimer.Stop(); }; this.syncVolumeUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
ConfigureButton(this.syncVolumeDownButton, 1218, 616, 205, 55, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, null); ConfigureButton(this.syncVolumeDownButton, 1218, 616, 205, 55, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, null);
this.syncVolumeDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowVolumeDownLabel(); volumeDownTimer.Start(); }; this.syncVolumeDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↓ ","a2 b4 a4");};
this.syncVolumeDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.HideAllLabels(); volumeDownTimer.Stop(); }; this.syncVolumeDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel();};
ConfigureButton(this.syncMicUpButton, 1218, 686, 205, 56, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, null); ConfigureButton(this.syncMicUpButton, 1218, 686, 205, 56, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, null);
this.syncMicUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowMicUpLabel(); micControlTimer.Tag = "a2 b5 a4"; micControlTimer.Start(); }; this.syncMicUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↑ ","a2 b5 a4");};
this.syncMicUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.HideAllLabels(); micControlTimer.Stop(); }; this.syncMicUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
ConfigureButton(this.syncMicDownButton, 1218, 756, 205, 56, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, null); ConfigureButton(this.syncMicDownButton, 1218, 756, 205, 56, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, resizedNormalStateImageForSyncScreen, null);
this.syncMicDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowMicDownLabel(); micControlTimer.Tag = "a2 b6 a4"; micControlTimer.Start(); }; this.syncMicDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↓ ","a2 b6 a4");};
this.syncMicDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.HideAllLabels(); micControlTimer.Stop(); }; this.syncMicDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };

View File

@ -150,10 +150,7 @@ namespace DualScreenDemo
private const int PanelEndTop = 739; // 修改為實際需要的下邊界 private const int PanelEndTop = 739; // 修改為實際需要的下邊界
private Timer lightControlTimer; private Timer lightControlTimer;
public Timer volumeUpTimer;
public Timer volumeDownTimer;
public Timer micControlTimer;
private SequenceManager sequenceManager = new SequenceManager(); private SequenceManager sequenceManager = new SequenceManager();
private PictureBox buttonMiddle; private PictureBox buttonMiddle;
private PictureBox buttonTopRight; private PictureBox buttonTopRight;
@ -201,16 +198,7 @@ namespace DualScreenDemo
lightControlTimer = new Timer(); lightControlTimer = new Timer();
lightControlTimer.Interval = 5; lightControlTimer.Interval = 5;
lightControlTimer.Tick += LightControlTimer_Tick; lightControlTimer.Tick += LightControlTimer_Tick;
volumeUpTimer = new Timer();
volumeUpTimer.Interval = 100;
volumeUpTimer.Tick += VolumeUpTimer_Tick;
volumeDownTimer = new Timer();
volumeDownTimer.Interval = 100;
volumeDownTimer.Tick += VolumeDownTimer_Tick;
micControlTimer = new Timer();
micControlTimer.Interval = 100;
micControlTimer.Tick += MicControlTimer_Tick;
InitializeRecording(); InitializeRecording();
InitializeMediaPlayer(); InitializeMediaPlayer();
LoadImages(); LoadImages();
@ -879,7 +867,7 @@ namespace DualScreenDemo
} }
} }
} }
private void LightControlTimer_Tick(object sender, EventArgs e) private void LightControlTimer_Tick(object sender, EventArgs e)
{ {
if(lightControlTimer.Tag != null) if(lightControlTimer.Tag != null)
@ -888,56 +876,6 @@ namespace DualScreenDemo
} }
} }
private void VolumeUpTimer_Tick(object sender, EventArgs e)
{
Task.Run(() =>
{
try
{
SendCommandThroughSerialPort("a2 b3 a4");
}
catch (Exception ex)
{
Console.WriteLine("Failed to send command: " + ex.Message);
}
});
}
private void VolumeDownTimer_Tick(object sender, EventArgs e)
{
Task.Run(() =>
{
try
{
SendCommandThroughSerialPort("a2 b4 a4");
}
catch (Exception ex)
{
Console.WriteLine("Failed to send command: " + ex.Message);
}
});
}
private void MicControlTimer_Tick(object sender, EventArgs e)
{
Task.Run(() =>
{
try
{
if(micControlTimer.Tag != null)
{
SendCommandThroughSerialPort(micControlTimer.Tag.ToString());
}
}
catch (Exception ex)
{
Console.WriteLine("Failed to send command: " + ex.Message);
}
});
}
public static void SendCommandThroughSerialPort(string command) public static void SendCommandThroughSerialPort(string command)
{ {
if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen) if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen)
@ -1104,8 +1042,8 @@ namespace DualScreenDemo
musicUpButton.BackgroundImageLayout = ImageLayout.Stretch; musicUpButton.BackgroundImageLayout = ImageLayout.Stretch;
musicUpButton.FlatStyle = FlatStyle.Flat; musicUpButton.FlatStyle = FlatStyle.Flat;
musicUpButton.FlatAppearance.BorderSize = 0; musicUpButton.FlatAppearance.BorderSize = 0;
musicUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowVolumeUpLabel(); volumeUpTimer.Start(); }; musicUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↑","a2 b3 a4"); };
musicUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.HideAllLabels(); volumeUpTimer.Stop(); }; musicUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
this.Controls.Add(musicUpButton); this.Controls.Add(musicUpButton);
@ -1117,8 +1055,8 @@ namespace DualScreenDemo
musicDownButton.BackgroundImageLayout = ImageLayout.Stretch; musicDownButton.BackgroundImageLayout = ImageLayout.Stretch;
musicDownButton.FlatStyle = FlatStyle.Flat; musicDownButton.FlatStyle = FlatStyle.Flat;
musicDownButton.FlatAppearance.BorderSize = 0; musicDownButton.FlatAppearance.BorderSize = 0;
musicDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowVolumeDownLabel(); volumeDownTimer.Start(); }; musicDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↓","a2 b4 a4"); };
musicDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.HideAllLabels(); volumeDownTimer.Stop(); }; musicDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
this.Controls.Add(musicDownButton); this.Controls.Add(musicDownButton);
@ -1130,8 +1068,8 @@ namespace DualScreenDemo
micUpButton.BackgroundImageLayout = ImageLayout.Stretch; micUpButton.BackgroundImageLayout = ImageLayout.Stretch;
micUpButton.FlatStyle = FlatStyle.Flat; micUpButton.FlatStyle = FlatStyle.Flat;
micUpButton.FlatAppearance.BorderSize = 0; micUpButton.FlatAppearance.BorderSize = 0;
micUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowMicUpLabel(); micControlTimer.Tag = "a2 b5 a4"; micControlTimer.Start(); }; micUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↑","a2 b5 a4"); };
micUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.HideAllLabels(); micControlTimer.Stop(); }; micUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
this.Controls.Add(micUpButton); this.Controls.Add(micUpButton);
@ -1143,8 +1081,8 @@ namespace DualScreenDemo
micDownButton.BackgroundImageLayout = ImageLayout.Stretch; micDownButton.BackgroundImageLayout = ImageLayout.Stretch;
micDownButton.FlatStyle = FlatStyle.Flat; micDownButton.FlatStyle = FlatStyle.Flat;
micDownButton.FlatAppearance.BorderSize = 0; micDownButton.FlatAppearance.BorderSize = 0;
micDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowMicDownLabel(); micControlTimer.Tag = "a2 b6 a4"; micControlTimer.Start(); }; micDownButton.MouseDown += (sender, e) =>{ OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↓","a2 b6 a4"); };
micDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.HideAllLabels(); micControlTimer.Stop(); }; micDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
this.Controls.Add(micDownButton); this.Controls.Add(micDownButton);
@ -2017,65 +1955,56 @@ namespace DualScreenDemo
private void MaleKeyButton_Click(object sender, EventArgs e) private void MaleKeyButton_Click(object sender, EventArgs e)
{ {
//verlayForm.MainForm.ShowTopRightLabelTime(" 男調 ");
if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen) if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen)
{ {
byte[] commandBytesIncreasePitch1 = new byte[] { 0xA2, 0x7F, 0xA4 }; byte[] commandBytesIncreasePitch1 = new byte[] { 0xA2, 0x7F, 0xA4 };
SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch1, 0, commandBytesIncreasePitch1.Length); SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch1, 0, commandBytesIncreasePitch1.Length);
OverlayForm.MainForm.HideAllLabels(); //OverlayForm.MainForm.HideAllLabels();
byte[] commandBytesDecreasePitch = new byte[] { 0xA2, 0xB2, 0xA4 }; byte[] commandBytesDecreasePitch = new byte[] { 0xA2, 0xB2, 0xA4 };
SerialPortManager.mySerialPort.Write(commandBytesDecreasePitch, 0, commandBytesDecreasePitch.Length); SerialPortManager.mySerialPort.Write(commandBytesDecreasePitch, 0, commandBytesDecreasePitch.Length);
OverlayForm.MainForm.HideAllLabels(); //OverlayForm.MainForm.HideAllLabels();
SerialPortManager.mySerialPort.Write(commandBytesDecreasePitch, 0, commandBytesDecreasePitch.Length); SerialPortManager.mySerialPort.Write(commandBytesDecreasePitch, 0, commandBytesDecreasePitch.Length);
OverlayForm.MainForm.HideAllLabels(); //OverlayForm.MainForm.HideAllLabels();
} }
else else
{ {
MessageBox.Show("串口未開啟,無法發送降調指令。"); MessageBox.Show("串口未開啟,無法發送降調指令。");
} }
OverlayForm.MainForm.ShowMaleKeyLabel();
} }
private void FemaleKeyButton_Click(object sender, EventArgs e) private void FemaleKeyButton_Click(object sender, EventArgs e)
{ {
//OverlayForm.MainForm.ShowTopRightLabelTime(" 女調 ");
if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen) if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen)
{ {
byte[] commandBytesIncreasePitch1 = new byte[] { 0xA2, 0x7F, 0xA4 }; byte[] commandBytesIncreasePitch1 = new byte[] { 0xA2, 0x7F, 0xA4 };
SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch1, 0, commandBytesIncreasePitch1.Length); SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch1, 0, commandBytesIncreasePitch1.Length);
OverlayForm.MainForm.HideAllLabels(); //OverlayForm.MainForm.HideAllLabels();
byte[] commandBytesIncreasePitch = new byte[] { 0xA2, 0xB1, 0xA4 }; byte[] commandBytesIncreasePitch = new byte[] { 0xA2, 0xB1, 0xA4 };
SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch, 0, commandBytesIncreasePitch.Length); SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch, 0, commandBytesIncreasePitch.Length);
OverlayForm.MainForm.HideAllLabels(); //OverlayForm.MainForm.HideAllLabels();
SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch, 0, commandBytesIncreasePitch.Length); SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch, 0, commandBytesIncreasePitch.Length);
OverlayForm.MainForm.HideAllLabels(); //OverlayForm.MainForm.HideAllLabels();
} }
else else
{ {
MessageBox.Show("串口未開啟,無法發送升調指令。"); MessageBox.Show("串口未開啟,無法發送升調指令。");
} }
OverlayForm.MainForm.ShowFemaleKeyLabel();
} }
private void StandardKeyButton_Click(object sender, EventArgs e) private void StandardKeyButton_Click(object sender, EventArgs e)
{ {
OverlayForm.MainForm.ShowStandardKeyLabel(); OverlayForm.MainForm.ShowTopRightLabelTime(" 標準調 ");
if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen) if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen)
{ {
byte[] commandBytesIncreasePitch = new byte[] { 0xA2, 0x7F, 0xA4 }; byte[] commandBytesIncreasePitch = new byte[] { 0xA2, 0x7F, 0xA4 };
SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch, 0, commandBytesIncreasePitch.Length); SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch, 0, commandBytesIncreasePitch.Length);
} }
else else
{ {
@ -2085,15 +2014,11 @@ namespace DualScreenDemo
private void PitchUpButton_Click(object sender, EventArgs e) private void PitchUpButton_Click(object sender, EventArgs e)
{ {
OverlayForm.MainForm.ShowKeyUpLabel(); OverlayForm.MainForm.ShowTopRightLabelTime("升 1# 調 ");
if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen) if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen)
{ {
byte[] commandBytesIncreasePitch = new byte[] { 0xA2, 0xB1, 0xA4 }; byte[] commandBytesIncreasePitch = new byte[] { 0xA2, 0xB1, 0xA4 };
SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch, 0, commandBytesIncreasePitch.Length); SerialPortManager.mySerialPort.Write(commandBytesIncreasePitch, 0, commandBytesIncreasePitch.Length);
} }
else else
{ {
@ -2103,15 +2028,11 @@ namespace DualScreenDemo
private void PitchDownButton_Click(object sender, EventArgs e) private void PitchDownButton_Click(object sender, EventArgs e)
{ {
OverlayForm.MainForm.ShowKeyDownLabel(); OverlayForm.MainForm.ShowTopRightLabelTime("降 1# 調 ");
if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen) if (SerialPortManager.mySerialPort != null && SerialPortManager.mySerialPort.IsOpen)
{ {
byte[] commandBytesDecreasePitch = new byte[] { 0xA2, 0xB2, 0xA4 }; byte[] commandBytesDecreasePitch = new byte[] { 0xA2, 0xB2, 0xA4 };
SerialPortManager.mySerialPort.Write(commandBytesDecreasePitch, 0, commandBytesDecreasePitch.Length); SerialPortManager.mySerialPort.Write(commandBytesDecreasePitch, 0, commandBytesDecreasePitch.Length);
} }
else else
{ {
@ -2131,18 +2052,12 @@ namespace DualScreenDemo
if (isWaiting) return; if (isWaiting) return;
isWaiting = true; isWaiting = true;
// 发送串口命令
SendCommandThroughSerialPort("a2 53 a4");
// 显示提示信息 // 显示提示信息
OverlayForm.MainForm.HideAllLabels(); //OverlayForm.MainForm.HideAllLabels();
OverlayForm.MainForm.ShowServiceBell(); OverlayForm.MainForm.ShowTopRightLabel("服務鈴","a2 53 a4");
// 延迟3秒 // 延迟3秒
await Task.Delay(3000); await Task.Delay(3000);
// 隐藏提示信息
//OverlayForm.MainForm.HideServiceBellLabel();
isWaiting = false; isWaiting = false;
} }

View File

@ -17,7 +17,7 @@ namespace DualScreenDemo
[STAThread] [STAThread]
static void Main() { static void Main() {
Console.WriteLine("Server V.1.2.0 20250703"); Console.WriteLine("Server V.1.2.1 20250716");
if(Utils.Env.GetBool("IsCursor", true))Cursor.Hide(); if(Utils.Env.GetBool("IsCursor", true))Cursor.Hide();
AppDomain.CurrentDomain.ProcessExit += (s, e) => Cursor.Show(); AppDomain.CurrentDomain.ProcessExit += (s, e) => Cursor.Show();
//Console.WriteLine("正在與中控取得聯繫..."); //Console.WriteLine("正在與中控取得聯繫...");

View File

@ -143,7 +143,7 @@ namespace DualScreenDemo
SongList.Add(closeSong); SongList.Add(closeSong);
if (IsFormReady(OverlayForm.MainForm)) if (IsFormReady(OverlayForm.MainForm))
OverlayForm.MainForm.nextSongLabel.Visible = false; OverlayForm.MainForm.topLeftLabel.Visible = false;
VideoPlayerForm.Instance.PlayNextSong(); VideoPlayerForm.Instance.PlayNextSong();
PrimaryForm.Instance.logout(); PrimaryForm.Instance.logout();

View File

@ -1098,8 +1098,7 @@ namespace DualScreenDemo
string labelText = isVocalRemoved ? "無人聲" : "有人聲"; string labelText = isVocalRemoved ? "無人聲" : "有人聲";
// 显示标签 // 显示标签
// 修改成新標籤 // 修改成新標籤
OverlayForm.MainForm.HideAllLabels(); OverlayForm.MainForm.ShowTopRightLabel(labelText);
OverlayForm.MainForm.ShowOriginalSongLabel(labelText);
//await Task.Delay(3000); //await Task.Delay(3000);
// 隐藏标签 // 隐藏标签
//OverlayForm.MainForm.HideOriginalSongLabel(); //OverlayForm.MainForm.HideOriginalSongLabel();