using System.IO; namespace DualScreenDemo { public partial class PrimaryForm { private Button newSongAlertButton; private Bitmap newSongAlertNormalBackground; private Bitmap newSongAlertActiveBackground; private Button guoYuButtonNewSong; private Bitmap guoYuNewSongNormalBackground; private Bitmap guoYuNewSongActiveBackground; private Button taiYuButtonNewSong; private Bitmap taiYuNewSongNormalBackground; private Bitmap taiYuNewSongActiveBackground; private Button yueYuButtonNewSong; private Bitmap yueYuNewSongNormalBackground; private Bitmap yueYuNewSongActiveBackground; private Button yingWenButtonNewSong; private Bitmap yingWenNewSongNormalBackground; private Bitmap yingWenNewSongActiveBackground; private Button riYuButtonNewSong; private Bitmap riYuNewSongNormalBackground; private Bitmap riYuNewSongActiveBackground; private Button hanYuButtonNewSong; private Bitmap hanYuNewSongNormalBackground; private Bitmap hanYuNewSongActiveBackground; private void UpdateNewSongBtns(Button activeButton, Image activeBackground) { guoYuButtonNewSong.BackgroundImage = guoYuNewSongNormalBackground; taiYuButtonNewSong.BackgroundImage = taiYuNewSongNormalBackground; yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground; yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground; riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground; hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground; activeButton.BackgroundImage = activeBackground; } private void InitializeButtonsForNewSong() { var data = LoadBtnConfigData(); InitializeButton(ref guoYuButtonNewSong, ref guoYuNewSongNormalBackground, ref guoYuNewSongActiveBackground, "guoYuButtonNewSong", 1197, 225, 225, 50, data["NewSongAlertBtn"]["GuoYuNewNormal"], data["NewSongAlertBtn"]["GuoYuNewActive"], GuoYuButtonNewSong_Click); InitializeButton(ref taiYuButtonNewSong, ref taiYuNewSongNormalBackground, ref taiYuNewSongActiveBackground, "taiYuButtonNewSong", 1197, 280, 225, 50, data["NewSongAlertBtn"]["TaiYuNewNormal"], data["NewSongAlertBtn"]["TaiYuNewActive"], TaiYuButtonNewSong_Click); InitializeButton(ref yueYuButtonNewSong, ref yueYuNewSongNormalBackground, ref yueYuNewSongActiveBackground, "yueYuButtonNewSong", 1197, 335, 225, 50, data["NewSongAlertBtn"]["YueYuNewNormal"], data["NewSongAlertBtn"]["YueYuNewActive"], YueYuButtonNewSong_Click); InitializeButton(ref yingWenButtonNewSong, ref yingWenNewSongNormalBackground, ref yingWenNewSongActiveBackground, "yingWenButtonNewSong", 1197, 390, 225, 50, data["NewSongAlertBtn"]["EngNewNormal"], data["NewSongAlertBtn"]["EngNewActive"], YingWenButtonNewSong_Click); InitializeButton(ref riYuButtonNewSong, ref riYuNewSongNormalBackground, ref riYuNewSongActiveBackground, "riYuButtonNewSong", 1197, 445, 225, 50, data["NewSongAlertBtn"]["JapNewNormal"], data["NewSongAlertBtn"]["JapNewActive"], RiYuButtonNewSong_Click); InitializeButton(ref hanYuButtonNewSong, ref hanYuNewSongNormalBackground, ref hanYuNewSongActiveBackground, "hanYuButtonNewSong", 1197, 500, 225, 50, data["NewSongAlertBtn"]["KrNewNormal"], data["NewSongAlertBtn"]["KrNewActive"], HanYuButtonNewSong_Click); } private void SetNewSongButtonsVisibility(bool isVisible) { Button[] pictureBox2Buttons = { guoYuButtonNewSong, taiYuButtonNewSong, yueYuButtonNewSong, yingWenButtonNewSong, riYuButtonNewSong, hanYuButtonNewSong }; foreach (var button in pictureBox2Buttons) { button.Visible = isVisible; if (isVisible) { button.BringToFront(); } } } private void NewSongAlertButton_Click(object sender, EventArgs e) { UpdateButtonBackgrounds(newSongAlertButton, newSongAlertActiveBackground); isOnOrderedSongsPage = false; /* 清空搜尋欄 */ ResetinputBox(); string query = setQueryforNewSong("國語"); var guoYuSongs2 = SearchSongs_Mysql(query); currentPage = 0; totalPages = (int)Math.Ceiling((double)guoYuSongs2.Count / itemsPerPage); multiPagePanel.currentPageIndex = 0; multiPagePanel.LoadSongs(guoYuSongs2); SetHotSongButtonsVisibility(false); SetSingerSearchButtonsVisibility(false); SetSongSearchButtonsVisibility(false); SetPictureBoxLanguageButtonsVisibility(false); SetGroupButtonsVisibility(false); SetPictureBoxCategoryAndButtonsVisibility(false); SetZhuYinSingersAndButtonsVisibility(false); SetZhuYinSongsAndButtonsVisibility(false); SetEnglishSingersAndButtonsVisibility(false); SetEnglishSongsAndButtonsVisibility(false); SetPinYinSingersAndButtonsVisibility(false); SetPinYinSongsAndButtonsVisibility(false); SetPictureBoxToggleLightAndButtonsVisibility(false); SetPictureBoxSceneSoundEffectsAndButtonsVisibility(false); SetNewSongButtonsVisibility(true); UpdateNewSongBtns(guoYuButtonNewSong, guoYuNewSongActiveBackground); if (pictureBoxQRCode != null) { pictureBoxQRCode.Visible = false; closeQRCodeButton.Visible = false; } } private string setQueryforNewSong(string category){ string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY add_date DESC LIMIT 1000;"; return query; } } }