superstar_v2/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.cs

134 lines
6.4 KiB
C#
Raw Normal View History

2025-08-06 10:47:43 +08:00
2025-04-07 16:54:10 +08:00
namespace DualScreenDemo
{
public partial class PrimaryForm
{
2025-08-07 13:09:10 +08:00
2025-04-07 16:54:10 +08:00
private Button zhuyinSearchButton;
2025-08-07 13:09:10 +08:00
private Bitmap zhuyinSearchNormalBackground;
private Bitmap zhuyinSearchActiveBackground;
2025-04-07 16:54:10 +08:00
private Button englishSearchButton;
2025-08-07 13:09:10 +08:00
private Bitmap englishSearchNormalBackground;
private Bitmap englishSearchActiveBackground;
2025-04-07 16:54:10 +08:00
private Button pinyinSearchButton;
2025-08-07 13:09:10 +08:00
private Bitmap pinyinSearchNormalBackground;
private Bitmap pinyinSearchActiveBackground;
2025-04-07 16:54:10 +08:00
private Button wordCountSearchButton;
2025-08-07 13:09:10 +08:00
private Bitmap wordCountSearchNormalBackground;
private Bitmap wordCountSearchActiveBackground;
2025-04-07 16:54:10 +08:00
private Button handWritingSearchButton;
2025-08-07 13:09:10 +08:00
private Bitmap handWritingSearchNormalBackground;
private Bitmap handWritingSearchActiveBackground;
2025-04-07 16:54:10 +08:00
private void UpdateSSearchBtn(Button activeButton, Image activeBackground)
{
zhuyinSearchButton.BackgroundImage = zhuyinSearchNormalBackground;
englishSearchButton.BackgroundImage = englishSearchNormalBackground;
pinyinSearchButton.BackgroundImage = pinyinSearchNormalBackground;
wordCountSearchButton.BackgroundImage = wordCountSearchNormalBackground;
handWritingSearchButton.BackgroundImage = handWritingSearchNormalBackground;
activeButton.BackgroundImage = activeBackground;
}
2025-04-07 16:54:10 +08:00
private void SingerSearchButton_Click(object sender, EventArgs e)
{
2025-08-07 13:09:10 +08:00
UpdateButtonBackgrounds(singerSearchButton, singerSearchActiveBackground);
2025-08-07 13:09:10 +08:00
2025-04-07 16:54:10 +08:00
isOnOrderedSongsPage = false;
/* 清空搜尋欄 */
ResetinputBox();
2025-08-06 10:47:43 +08:00
string query = $"SELECT * FROM artists WHERE category = '男' LIMIT 1000 ;";
var searchResult = SearchSingers_Mysql(query);
2025-08-07 13:09:10 +08:00
currentPage = 0;
currentArtistList = searchResult;
totalPages = (int)Math.Ceiling((double)searchResult.Count / itemsPerPage);
2025-04-07 16:54:10 +08:00
2025-08-07 13:09:10 +08:00
multiPagePanel.currentPageIndex = 0;
multiPagePanel.LoadSingers(currentArtistList);
2025-08-07 13:09:10 +08:00
2025-04-07 16:54:10 +08:00
SetHotSongButtonsVisibility(false);
SetNewSongButtonsVisibility(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);
2025-04-07 16:54:10 +08:00
SetSingerSearchButtonsVisibility(true);
2025-08-07 13:09:10 +08:00
2025-04-07 16:54:10 +08:00
if (pictureBoxQRCode != null)
{
pictureBoxQRCode.Visible = false;
closeQRCodeButton.Visible = false;
}
}
2025-08-07 13:09:10 +08:00
2025-04-07 16:54:10 +08:00
private void SetSingerSearchButtonsVisibility(bool isVisible)
{
Button[] singerSearchButtons = { zhuyinSearchButton, englishSearchButton, pinyinSearchButton, wordCountSearchButton, handWritingSearchButton };
foreach (var button in singerSearchButtons)
{
button.Visible = isVisible;
if (isVisible)
{
button.BringToFront();
}
}
}
private void InitializeButtonsForSingerSearch()
{
var data = LoadBtnConfigData();
InitializeButton(ref zhuyinSearchButton, ref zhuyinSearchNormalBackground, ref zhuyinSearchActiveBackground, "zhuyinSearchButton", 1197, 225, 225, 50, data["SingerSearch"]["ZhuYinSingerNormal"], data["SingerSearch"]["ZhuYinSingerActive"], ZhuyinSearchSingersButton_Click);
2025-08-07 13:09:10 +08:00
InitializeButton(ref englishSearchButton, ref englishSearchNormalBackground, ref englishSearchActiveBackground, "englishSearchButton", 1197, 280, 225, 50, data["SingerSearch"]["EngSingerNormal"], data["SingerSearch"]["EngSingerActive"], EnglishSearchSingersButton_Click);
2025-08-07 13:09:10 +08:00
2025-04-07 16:54:10 +08:00
InitializeButton(ref pinyinSearchButton, ref pinyinSearchNormalBackground, ref pinyinSearchActiveBackground, "pinyinSearchButton", 1197, 335, 225, 50, data["SingerSearch"]["PinYinSingerNormal"], data["SingerSearch"]["PinYinSingerActive"], PinyinSingerSearchButton_Click);
2025-08-07 13:09:10 +08:00
2025-04-07 16:54:10 +08:00
InitializeButton(ref wordCountSearchButton, ref wordCountSearchNormalBackground, ref wordCountSearchActiveBackground, "wordCountSearchButton", 1197, 390, 225, 50, data["SingerSearch"]["WordCntSingerNormal"], data["SingerSearch"]["WordCntSingerActive"], WordCountSearchSingersButton_Click);
2025-08-07 13:09:10 +08:00
2025-04-07 16:54:10 +08:00
2025-08-13 16:42:22 +08:00
InitializeButton(ref handWritingSearchButton, ref handWritingSearchNormalBackground, ref handWritingSearchActiveBackground, "handWritingSearchButton", 1197, 445, 225, 50, data["SingerSearch"]["HWritingSingerNormal"], data["SingerSearch"]["HWritingSingerActive"], HandWritingSearchButtonForSingers_Click);
2025-04-07 16:54:10 +08:00
}
private void InitializeSearchButton(ref Button button, string name, int x, int y, int width, int height, ref Bitmap normalBackground, ref Bitmap activeBackground, Bitmap normalImage, Bitmap activeImage, EventHandler clickEventHandler)
{
button = new Button { Text = "", Visible = true, Name = name };
ResizeAndPositionButton(button, x, y, width, height);
Rectangle buttonCropArea = new Rectangle(x, y, width, height);
2025-08-06 10:47:43 +08:00
//normalBackground = normalImage.Clone(buttonCropArea, normalImage.PixelFormat);
//activeBackground = activeImage.Clone(buttonCropArea, activeImage.PixelFormat);
2025-04-07 16:54:10 +08:00
button.BackgroundImage = normalBackground;
button.BackgroundImageLayout = ImageLayout.Stretch;
button.FlatStyle = FlatStyle.Flat;
2025-08-07 13:09:10 +08:00
button.FlatAppearance.BorderSize = 0;
2025-04-07 16:54:10 +08:00
button.Click += clickEventHandler;
this.Controls.Add(button);
}
}
}