刪除修正

This commit is contained in:
allen.yan 2025-08-08 17:33:19 +08:00
parent be3f05122d
commit 612f995b4f

View File

@ -174,8 +174,10 @@ namespace DualScreenDemo
private static Bitmap resizedMouseDownImageForHotSong; private static Bitmap resizedMouseDownImageForHotSong;
private PictureBox serviceBellPictureBox; // 添加为类成员变量 private PictureBox serviceBellPictureBox; // 添加为类成员变量
private Timer autoRefreshTimer; private Timer autoRefreshTimer;
private TimeSpan remainingTime;
private Timer timerCountdown;
string Rtime;
//private Label pageNumberLabel; // 添加頁碼標籤 //private Label pageNumberLabel; // 添加頁碼標籤
public PrimaryForm() public PrimaryForm()
@ -226,6 +228,11 @@ namespace DualScreenDemo
multiPagePanel.PageIndexChanged += HandlePageChanged; multiPagePanel.PageIndexChanged += HandlePageChanged;
// 添加 Load 事件處理 // 添加 Load 事件處理
this.Load += PrimaryForm_Load; this.Load += PrimaryForm_Load;
timerCountdown = new Timer();
timerCountdown.Interval = 1000; // 1 second
timerCountdown.Tick += TimerCountdown_Tick;
} }
// 添加 DPI 感知支持 // 添加 DPI 感知支持
@ -245,6 +252,34 @@ namespace DualScreenDemo
} }
} }
public void RoomTimeStart()
{
//DateTime now = DateTime.Now;
//DateTime tenMinutesLater = now.AddMinutes(120);
//remainingTime = tenMinutesLater - now;
remainingTime = Program.room.timePeriod;
timerCountdown.Start();
}
private async void TimerCountdown_Tick(object sender, EventArgs e)
{
if (remainingTime.TotalSeconds > 0)
{
remainingTime = remainingTime.Subtract(TimeSpan.FromSeconds(1));
Rtime = remainingTime.ToString(@"hh\:mm\:ss");
this.Invalidate();
}
else
{
timerCountdown.Stop();
await Task.Delay(10000);
Program.room.setDB("closed");
Program.room.set("");
}
}
private void PrimaryForm_Paint(object sender, PaintEventArgs e) private void PrimaryForm_Paint(object sender, PaintEventArgs e)
{ {
// 取得本機電腦的主機名稱 (hostname) // 取得本機電腦的主機名稱 (hostname)
@ -252,7 +287,7 @@ namespace DualScreenDemo
string version = Program.verSion; string version = Program.verSion;
// 顯示包廂名稱 // 顯示包廂名稱
// 取主機名稱的最後 20 個字元 (如果長度不足 20則取全部) // 取主機名稱的最後 20 個字元 (如果長度不足 20則取全部)
string displayName = "包廂" + hostName.Substring(Math.Max(0, hostName.Length - 3)); string displayName = "包廂" + hostName.Substring(Math.Max(0, hostName.Length - 3)) + " " + Rtime;
string totalPages = multiPagePanel.totalPages.ToString() == "0" ? "1" : multiPagePanel.totalPages.ToString(); string totalPages = multiPagePanel.totalPages.ToString() == "0" ? "1" : multiPagePanel.totalPages.ToString();
string pageNumber = (multiPagePanel.currentPageIndex + 1).ToString() + "/" + totalPages; string pageNumber = (multiPagePanel.currentPageIndex + 1).ToString() + "/" + totalPages;
@ -509,7 +544,7 @@ namespace DualScreenDemo
InitializeButtonsForFavoritePictureBox(); InitializeButtonsForFavoritePictureBox();
InitializePromotionsButton(); InitializePromotionsButton();
InitializeButtonsForPictureBoxToggleLight(); InitializeButtonsForPictureBoxToggleLight();
InitializeButtonsForVodScreenPictureBox(); //InitializeButtonsForVodScreenPictureBox();
InitializeSoundEffectButtons(); InitializeSoundEffectButtons();
InitializeSyncScreen(); InitializeSyncScreen();
@ -1007,7 +1042,7 @@ namespace DualScreenDemo
{ {
var data = LoadBtnConfigData(); var data = LoadBtnConfigData();
InitializeButton(ref newSongAlertButton, ref newSongAlertNormalBackground, ref newSongAlertActiveBackground, "newSongAlertButton", 20, 98, 105, 120, data["PrimaryFormBtn"]["AlertNormal"],data["PrimaryFormBtn"]["AlertActive"], NewSongAlertButton_Click); InitializeButton(ref newSongAlertButton, ref newSongAlertNormalBackground, ref newSongAlertActiveBackground, "newSongAlertButton", 20, 98, 105, 120, data["PrimaryFormBtn"]["AlertNormal"], data["PrimaryFormBtn"]["AlertActive"], NewSongAlertButton_Click);
InitializeButton(ref hotPlayButton, ref hotPlayNormalBackground, ref hotPlayActiveBackground, "hotPlayButton", 137, 98, 106, 120, data["PrimaryFormBtn"]["HotNormal"], data["PrimaryFormBtn"]["HotActive"], HotPlayButton_Click); InitializeButton(ref hotPlayButton, ref hotPlayNormalBackground, ref hotPlayActiveBackground, "hotPlayButton", 137, 98, 106, 120, data["PrimaryFormBtn"]["HotNormal"], data["PrimaryFormBtn"]["HotActive"], HotPlayButton_Click);
@ -1111,9 +1146,11 @@ namespace DualScreenDemo
ReplayButton_Click); ReplayButton_Click);
pauseButton = new Button{ pauseButton = new Button
{
Text = "", Text = "",
Name = "pauseButton" }; Name = "pauseButton"
};
ConfigureButton(pauseButton, 456, 738, 93, 62, ConfigureButton(pauseButton, 456, 738, 93, 62,
new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")),
new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")),
@ -1147,7 +1184,7 @@ namespace DualScreenDemo
maleKeyButton.Name = "maleKeyButton"; maleKeyButton.Name = "maleKeyButton";
ConfigureButton(maleKeyButton, 564, 738, 93, 62, ConfigureButton(maleKeyButton, 564, 738, 93, 62,
new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")),
new Bitmap(Path.Combine(serverPath , "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")),
new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")),
MaleKeyButton_Click); MaleKeyButton_Click);
@ -1245,7 +1282,7 @@ namespace DualScreenDemo
btnApplause = new Button { Text = "" }; btnApplause = new Button { Text = "" };
btnApplause.Name = "btnApplause"; btnApplause.Name = "btnApplause";
ConfigureButton(btnApplause, 1110, 823, 93, 62, ConfigureButton(btnApplause, 1110, 823, 93, 62,
new Bitmap(Path.Combine(serverPath , "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")),
new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")),
new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")),
ApplauseButton_Click); ApplauseButton_Click);
@ -1328,6 +1365,8 @@ namespace DualScreenDemo
public void Label_Click(object sender, EventArgs e) public void Label_Click(object sender, EventArgs e)
{ {
InitializeButtonsForVodScreenPictureBox();
var data = LoadConfigData(); var data = LoadConfigData();
var label = sender as Label; var label = sender as Label;
if (label != null && label.Tag is SongData) if (label != null && label.Tag is SongData)
@ -1458,7 +1497,7 @@ namespace DualScreenDemo
resizedMouseDownImageForArtistQuery = ResizeImage(mouseDownImageArtistQuery, targetWidth, targetHeight); resizedMouseDownImageForArtistQuery = ResizeImage(mouseDownImageArtistQuery, targetWidth, targetHeight);
normalStateImageSongQuery = new Bitmap(Path.Combine(serverPath , "themes\\superstar\\主畫面\\4.歌名查詢_未按.jpg")); normalStateImageSongQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\4.歌名查詢_未按.jpg"));
resizedNormalStateImageForSongQuery = ResizeImage(normalStateImageSongQuery, targetWidth, targetHeight); resizedNormalStateImageForSongQuery = ResizeImage(normalStateImageSongQuery, targetWidth, targetHeight);
@ -1661,16 +1700,7 @@ namespace DualScreenDemo
{ {
var data = LoadConfigData(); var data = LoadConfigData();
newSongAlertButton.BackgroundImage = newSongAlertNormalBackground; ResetPrimaryBtnStatus();
hotPlayButton.BackgroundImage = hotPlayNormalBackground;
singerSearchButton.BackgroundImage = singerSearchNormalBackground;
songSearchButton.BackgroundImage = songSearchNormalBackground;
languageSearchButton.BackgroundImage = languageSearchNormalBackground;
groupSearchButton.BackgroundImage = groupSearchNormalBackground;
categorySearchButton.BackgroundImage = categorySearchNormalBackground;
orderedSongsButton.BackgroundImage = orderedSongsNormalBackground;
myFavoritesButton.BackgroundImage = myFavoritesNormalBackground;
promotionsButton.BackgroundImage = promotionsNormalBackground;
deliciousFoodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_美味菜單(已按).png")); deliciousFoodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_美味菜單(已按).png"));
isOnOrderedSongsPage = false; isOnOrderedSongsPage = false;
@ -2220,19 +2250,11 @@ namespace DualScreenDemo
private void OrderedSongsButton_Click(object sender, EventArgs e) private void OrderedSongsButton_Click(object sender, EventArgs e)
{ {
var data= LoadConfigData(); var data = LoadConfigData();
newSongAlertButton.BackgroundImage = newSongAlertNormalBackground; ResetPrimaryBtnStatus();
hotPlayButton.BackgroundImage = hotPlayNormalBackground;
singerSearchButton.BackgroundImage = singerSearchNormalBackground;
songSearchButton.BackgroundImage = songSearchNormalBackground;
languageSearchButton.BackgroundImage = languageSearchNormalBackground;
groupSearchButton.BackgroundImage = groupSearchNormalBackground;
categorySearchButton.BackgroundImage = categorySearchNormalBackground;
orderedSongsButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_已點歌曲(已按).png")); orderedSongsButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_已點歌曲(已按).png"));
myFavoritesButton.BackgroundImage = myFavoritesNormalBackground;
promotionsButton.BackgroundImage = promotionsNormalBackground;
deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground;
isOnOrderedSongsPage = true; isOnOrderedSongsPage = true;
autoRefreshTimer.Start(); // 开始自动刷新 autoRefreshTimer.Start(); // 开始自动刷新