superstar_v2/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.cs

138 lines
7.9 KiB
C#

using System.IO;
namespace DualScreenDemo
{
public partial class PrimaryForm
{
private Button zhuyinSearchButton;
private Bitmap zhuyinSearchNormalBackground;
private Bitmap zhuyinSearchActiveBackground;
private Button englishSearchButton;
private Bitmap englishSearchNormalBackground;
private Bitmap englishSearchActiveBackground;
private Button pinyinSearchButton;
private Bitmap pinyinSearchNormalBackground;
private Bitmap pinyinSearchActiveBackground;
private Button wordCountSearchButton;
private Bitmap wordCountSearchNormalBackground;
private Bitmap wordCountSearchActiveBackground;
private Button handWritingSearchButton;
private Bitmap handWritingSearchNormalBackground;
private Bitmap handWritingSearchActiveBackground;
private void SingerSearchButton_Click(object sender, EventArgs e)
{
newSongAlertButton.BackgroundImage = newSongAlertNormalBackground;
hotPlayButton.BackgroundImage = hotPlayNormalBackground;
//singerSearchButton.BackgroundImage = singerSearchActiveBackground;
singerSearchButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_歌星查詢(已按).png")); ;
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();
string query = $"SELECT * FROM artists WHERE category = '男' LIMIT 1000 ;";
var searchResult = SearchSingers_Mysql(query);
currentPage = 0;
currentArtistList = searchResult;
totalPages = (int)Math.Ceiling((double)searchResult.Count / itemsPerPage);
multiPagePanel.currentPageIndex = 0;
multiPagePanel.LoadSingers(currentArtistList);
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);
if (pictureBoxQRCode != null)
{
pictureBoxQRCode.Visible = false;
closeQRCodeButton.Visible = false;
}
}
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()
{
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"));
InitializeSearchButton(ref zhuyinSearchButton, "zhuyinSearchButton", 1197, 225, 225, 50, ref zhuyinSearchNormalBackground, ref zhuyinSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, ZhuyinSearchSingersButton_Click);
InitializeSearchButton(ref englishSearchButton, "englishSearchButton", 1197, 280, 225, 50, ref englishSearchNormalBackground, ref englishSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, EnglishSearchSingersButton_Click);
InitializeSearchButton(ref pinyinSearchButton, "pinyinSearchButton", 1197, 335, 225, 50, ref pinyinSearchNormalBackground, ref pinyinSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, PinyinSingerSearchButton_Click);
InitializeSearchButton(ref wordCountSearchButton, "workCountSearchButton", 1197, 390, 225, 50, ref wordCountSearchNormalBackground, ref wordCountSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, WordCountSearchSingersButton_Click);
InitializeSearchButton(ref handWritingSearchButton, "handWritingSearchButton", 1197, 445, 225, 50, ref handWritingSearchNormalBackground, ref handWritingSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, HandWritingSearchButtonForSingers_Click);
}
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);
//normalBackground = normalImage.Clone(buttonCropArea, normalImage.PixelFormat);
//activeBackground = activeImage.Clone(buttonCropArea, activeImage.PixelFormat);
button.BackgroundImage = normalBackground;
button.BackgroundImageLayout = ImageLayout.Stretch;
button.FlatStyle = FlatStyle.Flat;
button.FlatAppearance.BorderSize = 0;
button.Click += clickEventHandler;
this.Controls.Add(button);
}
}
}