superstar_v2/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.cs

138 lines
7.9 KiB
C#
Raw Normal View History

2025-08-06 10:47:43 +08:00
using System.IO;
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 SingerSearchButton_Click(object sender, EventArgs e)
{
2025-08-07 13:09:10 +08:00
2025-04-07 16:54:10 +08:00
newSongAlertButton.BackgroundImage = newSongAlertNormalBackground;
hotPlayButton.BackgroundImage = hotPlayNormalBackground;
2025-08-06 10:47:43 +08:00
//singerSearchButton.BackgroundImage = singerSearchActiveBackground;
2025-08-07 13:09:10 +08:00
singerSearchButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_歌星查詢(已按).png")); ;
2025-04-07 16:54:10 +08:00
songSearchButton.BackgroundImage = songSearchNormalBackground;
languageSearchButton.BackgroundImage = languageSearchNormalBackground;
groupSearchButton.BackgroundImage = groupSearchNormalBackground;
categorySearchButton.BackgroundImage = categorySearchNormalBackground;
orderedSongsButton.BackgroundImage = orderedSongsNormalBackground;
myFavoritesButton.BackgroundImage = myFavoritesNormalBackground;
promotionsButton.BackgroundImage = promotionsNormalBackground;
deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground;
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);
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()
{
2025-08-07 13:09:10 +08:00
zhuyinSearchNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\3.歌星查詢_注音查詢(未按).png"));
zhuyinSearchActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\3.歌星查詢_注音查詢(已按).png")); ;
englishSearchNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\3.歌星查詢_英文查詢(未按).png"));
englishSearchActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\3.歌星查詢_英文查詢(已按).png"));
pinyinSearchNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\3.歌星查詢_拼音查詢(未按).png"));
pinyinSearchActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\3.歌星查詢_拼音查詢(已按).png"));
wordCountSearchNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\3.歌星查詢_字數查詢(未按).png"));
wordCountSearchActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\3.歌星查詢_字數查詢(已按).png"));
handWritingSearchNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\3.歌星查詢_手寫查詢(未按).png"));
handWritingSearchActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\3.歌星查詢_手寫查詢(已按).png"));
2025-08-06 10:47:43 +08:00
InitializeSearchButton(ref zhuyinSearchButton, "zhuyinSearchButton", 1197, 225, 225, 50, ref zhuyinSearchNormalBackground, ref zhuyinSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, ZhuyinSearchSingersButton_Click);
2025-04-07 16:54:10 +08:00
2025-08-07 13:09:10 +08:00
2025-08-06 10:47:43 +08:00
InitializeSearchButton(ref englishSearchButton, "englishSearchButton", 1197, 280, 225, 50, ref englishSearchNormalBackground, ref englishSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, EnglishSearchSingersButton_Click);
2025-04-07 16:54:10 +08:00
2025-08-07 13:09:10 +08:00
2025-08-06 10:47:43 +08:00
InitializeSearchButton(ref pinyinSearchButton, "pinyinSearchButton", 1197, 335, 225, 50, ref pinyinSearchNormalBackground, ref pinyinSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, PinyinSingerSearchButton_Click);
2025-04-07 16:54:10 +08:00
2025-08-06 10:47:43 +08:00
InitializeSearchButton(ref wordCountSearchButton, "workCountSearchButton", 1197, 390, 225, 50, ref wordCountSearchNormalBackground, ref wordCountSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, WordCountSearchSingersButton_Click);
2025-04-07 16:54:10 +08:00
2025-08-06 10:47:43 +08:00
InitializeSearchButton(ref handWritingSearchButton, "handWritingSearchButton", 1197, 445, 225, 50, ref handWritingSearchNormalBackground, ref handWritingSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, 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);
}
}
}