2025-04-11 09:50:48 +08:00
|
|
|
using DBObj;
|
|
|
|
using MySqlConnector;
|
|
|
|
using System.Globalization;
|
|
|
|
|
2025-04-07 16:54:10 +08:00
|
|
|
namespace DualScreenDemo
|
|
|
|
{
|
|
|
|
public partial class PrimaryForm
|
2025-08-12 17:11:13 +08:00
|
|
|
{
|
2025-04-07 16:54:10 +08:00
|
|
|
private Button languageSearchButton;
|
|
|
|
private Bitmap languageSearchNormalBackground;
|
|
|
|
private Bitmap languageSearchActiveBackground;
|
|
|
|
|
|
|
|
private Button guoYuButton;
|
|
|
|
private Bitmap guoYuNormalBackground;
|
|
|
|
private Bitmap guoYuActiveBackground;
|
|
|
|
private Button taiYuButton;
|
|
|
|
private Bitmap taiYuNormalBackground;
|
|
|
|
private Bitmap taiYuActiveBackground;
|
|
|
|
private Button yueYuButton;
|
|
|
|
private Bitmap yueYuNormalBackground;
|
|
|
|
private Bitmap yueYuActiveBackground;
|
|
|
|
private Button yingWenButton;
|
|
|
|
private Bitmap yingWenNormalBackground;
|
|
|
|
private Bitmap yingWenActiveBackground;
|
|
|
|
private Button riYuButton;
|
|
|
|
private Bitmap riYuNormalBackground;
|
|
|
|
private Bitmap riYuActiveBackground;
|
|
|
|
private Button hanYuButton;
|
|
|
|
private Bitmap hanYuNormalBackground;
|
|
|
|
private Bitmap hanYuActiveBackground;
|
|
|
|
private Button keYuButton;
|
|
|
|
private Bitmap keYuNormalBackground;
|
|
|
|
private Bitmap keYuActiveBackground;
|
|
|
|
|
2025-08-12 17:11:13 +08:00
|
|
|
private void UpdateLangBtns(Button activeButton, Image activeBackground)
|
2025-04-07 16:54:10 +08:00
|
|
|
{
|
2025-08-12 17:11:13 +08:00
|
|
|
guoYuButton.BackgroundImage = guoYuNormalBackground;
|
2025-04-07 16:54:10 +08:00
|
|
|
taiYuButton.BackgroundImage = taiYuNormalBackground;
|
|
|
|
yueYuButton.BackgroundImage = yueYuNormalBackground;
|
|
|
|
yingWenButton.BackgroundImage = yingWenNormalBackground;
|
|
|
|
riYuButton.BackgroundImage = riYuNormalBackground;
|
|
|
|
hanYuButton.BackgroundImage = hanYuNormalBackground;
|
|
|
|
keYuButton.BackgroundImage = keYuNormalBackground;
|
|
|
|
|
2025-08-12 17:11:13 +08:00
|
|
|
activeButton.BackgroundImage = activeBackground;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void InitializeLangSearchButtons()
|
|
|
|
{
|
|
|
|
var data = LoadBtnConfigData();
|
|
|
|
|
|
|
|
|
|
|
|
InitializeButton(ref guoYuButton, ref guoYuNormalBackground, ref guoYuActiveBackground, "guoYuButton", 1197, 225, 225, 50, data["LangSearchSubBtn"]["GuoYuLangNormal"], data["LangSearchSubBtn"]["GuoYuLangActive"], GuoYuButton_Click);
|
|
|
|
|
|
|
|
InitializeButton(ref taiYuButton, ref taiYuNormalBackground, ref taiYuActiveBackground, "taiYuButton", 1197, 280, 225, 50, data["LangSearchSubBtn"]["TaiYuLangNormal"], data["LangSearchSubBtn"]["TaiYuLangActive"], TaiYuButton_Click);
|
|
|
|
|
|
|
|
InitializeButton(ref yueYuButton, ref yueYuNormalBackground, ref yueYuActiveBackground, "yueYuButton", 1197, 335, 225, 50, data["LangSearchSubBtn"]["YueYuLangNormal"], data["LangSearchSubBtn"]["YueYuLangActive"], YueYuButton_Click);
|
|
|
|
|
|
|
|
InitializeButton(ref yingWenButton, ref yingWenNormalBackground, ref yingWenActiveBackground, "yingWenButton", 1197, 390, 225, 50, data["LangSearchSubBtn"]["EngLangNormal"], data["LangSearchSubBtn"]["EngLangActive"], YingWenButton_Click);
|
|
|
|
|
|
|
|
InitializeButton(ref riYuButton, ref riYuNormalBackground, ref riYuActiveBackground, "riYuButton", 1197, 445, 225, 50, data["LangSearchSubBtn"]["JapLangNormal"], data["LangSearchSubBtn"]["JapLangActive"], RiYuButton_Click);
|
|
|
|
|
|
|
|
InitializeButton(ref hanYuButton, ref hanYuNormalBackground, ref hanYuActiveBackground, "hanYuButton", 1197, 500, 225, 50, data["LangSearchSubBtn"]["KrLangNormal"], data["LangSearchSubBtn"]["KrLangActive"], HanYuButton_Click);
|
|
|
|
|
|
|
|
InitializeButton(ref keYuButton, ref keYuNormalBackground, ref keYuActiveBackground, "keYuButton", 1197, 555, 225, 50, data["LangSearchSubBtn"]["KeYuLangNormal"], data["LangSearchSubBtn"]["KeYuLangActive"], KeYuButton_Click);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
private void LanguageSongSelectionButton_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
UpdateButtonBackgrounds(languageSearchButton, languageSearchActiveBackground);
|
|
|
|
isOnOrderedSongsPage = false;
|
|
|
|
|
|
|
|
|
2025-04-23 13:55:11 +08:00
|
|
|
/* 清空搜尋欄 */
|
|
|
|
ResetinputBox();
|
2025-08-06 10:47:43 +08:00
|
|
|
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_counts DESC LIMIT 1000";
|
2025-04-11 09:50:48 +08:00
|
|
|
var guoYuSongs = SearchSongs_Mysql(query);
|
2025-04-07 16:54:10 +08:00
|
|
|
currentPage = 0;
|
|
|
|
totalPages = (int)Math.Ceiling((double)guoYuSongs.Count / itemsPerPage);
|
|
|
|
|
|
|
|
multiPagePanel.currentPageIndex = 0;
|
2025-07-11 13:35:47 +08:00
|
|
|
multiPagePanel.LoadSongs(guoYuSongs);
|
2025-04-07 16:54:10 +08:00
|
|
|
|
|
|
|
SetHotSongButtonsVisibility(false);
|
|
|
|
SetNewSongButtonsVisibility(false);
|
|
|
|
SetSingerSearchButtonsVisibility(false);
|
|
|
|
SetSongSearchButtonsVisibility(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);
|
|
|
|
|
2025-04-07 16:54:10 +08:00
|
|
|
SetPictureBoxLanguageButtonsVisibility(true);
|
|
|
|
|
2025-08-12 17:11:13 +08:00
|
|
|
|
|
|
|
UpdateLangBtns(guoYuButton, guoYuActiveBackground);
|
|
|
|
|
|
|
|
|
2025-04-07 16:54:10 +08:00
|
|
|
if (pictureBoxQRCode != null)
|
|
|
|
{
|
|
|
|
pictureBoxQRCode.Visible = false;
|
|
|
|
closeQRCodeButton.Visible = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void OnLanguageButtonClick(Button activeButton, Image activeBackground, string category)
|
|
|
|
{
|
|
|
|
|
2025-08-12 17:11:13 +08:00
|
|
|
UpdateLangBtns(activeButton, activeBackground);
|
|
|
|
|
2025-08-06 10:47:43 +08:00
|
|
|
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY song_counts DESC LIMIT 1000";
|
2025-04-11 09:50:48 +08:00
|
|
|
var selectedSongs = SearchSongs_Mysql(query);
|
2025-07-11 13:35:47 +08:00
|
|
|
|
2025-04-07 16:54:10 +08:00
|
|
|
currentPage = 0;
|
|
|
|
totalPages = (int)Math.Ceiling((double)selectedSongs.Count / itemsPerPage);
|
|
|
|
|
|
|
|
multiPagePanel.currentPageIndex = 0;
|
2025-07-11 13:35:47 +08:00
|
|
|
multiPagePanel.LoadSongs(selectedSongs);
|
2025-04-07 16:54:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private void SetPictureBoxLanguageButtonsVisibility(bool isVisible)
|
2025-08-12 17:11:13 +08:00
|
|
|
{
|
2025-04-07 16:54:10 +08:00
|
|
|
guoYuButton.Visible = isVisible;
|
|
|
|
guoYuButton.BringToFront();
|
2025-08-12 17:11:13 +08:00
|
|
|
|
2025-04-07 16:54:10 +08:00
|
|
|
taiYuButton.Visible = isVisible;
|
|
|
|
taiYuButton.BringToFront();
|
2025-08-12 17:11:13 +08:00
|
|
|
|
2025-04-07 16:54:10 +08:00
|
|
|
yueYuButton.Visible = isVisible;
|
|
|
|
yueYuButton.BringToFront();
|
2025-08-12 17:11:13 +08:00
|
|
|
|
2025-04-07 16:54:10 +08:00
|
|
|
yingWenButton.Visible = isVisible;
|
|
|
|
yingWenButton.BringToFront();
|
2025-08-12 17:11:13 +08:00
|
|
|
|
2025-04-07 16:54:10 +08:00
|
|
|
riYuButton.Visible = isVisible;
|
|
|
|
riYuButton.BringToFront();
|
2025-08-12 17:11:13 +08:00
|
|
|
|
2025-04-07 16:54:10 +08:00
|
|
|
hanYuButton.Visible = isVisible;
|
|
|
|
hanYuButton.BringToFront();
|
|
|
|
|
|
|
|
keYuButton.Visible = isVisible;
|
|
|
|
keYuButton.BringToFront();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|