superstar_v2/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs

137 lines
6.2 KiB
C#
Raw Normal View History

2025-04-07 16:54:10 +08:00
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)
2025-04-07 16:54:10 +08:00
{
guoYuButtonNewSong.BackgroundImage = guoYuNewSongNormalBackground;
taiYuButtonNewSong.BackgroundImage = taiYuNewSongNormalBackground;
yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground;
yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground;
riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground;
hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground;
2025-04-07 16:54:10 +08:00
activeButton.BackgroundImage = activeBackground;
2025-04-07 16:54:10 +08:00
}
private void InitializeButtonsForNewSong()
2025-04-07 16:54:10 +08:00
{
var data = LoadBtnConfigData();
2025-04-07 16:54:10 +08:00
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)
{
2025-04-07 16:54:10 +08:00
Button[] pictureBox2Buttons = { guoYuButtonNewSong, taiYuButtonNewSong, yueYuButtonNewSong, yingWenButtonNewSong, riYuButtonNewSong, hanYuButtonNewSong };
2025-04-07 16:54:10 +08:00
foreach (var button in pictureBox2Buttons)
{
button.Visible = isVisible;
if (isVisible)
{
button.BringToFront();
}
}
}
private void NewSongAlertButton_Click(object sender, EventArgs e)
{
UpdateButtonBackgrounds(newSongAlertButton, newSongAlertActiveBackground);
2025-04-07 16:54:10 +08:00
isOnOrderedSongsPage = false;
2025-04-23 13:55:11 +08:00
/* 清空搜尋欄 */
ResetinputBox();
2025-04-14 16:32:29 +08:00
string query = setQueryforNewSong("國語");
var guoYuSongs2 = SearchSongs_Mysql(query);
2025-04-07 16:54:10 +08:00
currentPage = 0;
totalPages = (int)Math.Ceiling((double)guoYuSongs2.Count / itemsPerPage);
multiPagePanel.currentPageIndex = 0;
multiPagePanel.LoadSongs(guoYuSongs2);
2025-04-07 16:54:10 +08:00
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);
2025-08-13 16:42:22 +08:00
SetHandWritingForSongsAndButtonsVisibility(false);
SetWordCountSongsAndButtonsVisibility(false);
SetSongIDSearchAndButtonsVisibility(false);
SetHandWritingForSingersAndButtonsVisibility(false);
SetWordCountSingersAndButtonsVisibility(false);
SetNewSongButtonsVisibility(true);
UpdateNewSongBtns(guoYuButtonNewSong, guoYuNewSongActiveBackground);
2025-04-07 16:54:10 +08:00
if (pictureBoxQRCode != null)
{
pictureBoxQRCode.Visible = false;
closeQRCodeButton.Visible = false;
}
}
2025-04-14 16:32:29 +08:00
private string setQueryforNewSong(string category){
2025-08-06 10:47:43 +08:00
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY add_date DESC LIMIT 1000;";
2025-04-22 15:25:58 +08:00
2025-04-14 16:32:29 +08:00
return query;
}
2025-04-07 16:54:10 +08:00
}
}