superstar_v2/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs

224 lines
11 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 ToggleNewSongButtonsVisibility()
{
bool areButtonsVisible = guoYuButtonNewSong.Visible;
SetNewSongButtonsVisibility(!areButtonsVisible);
}
private void SetNewSongButtonsVisibility(bool isVisible)
{
Button[] pictureBox2Buttons = { guoYuButtonNewSong, taiYuButtonNewSong, yueYuButtonNewSong, yingWenButtonNewSong, riYuButtonNewSong, hanYuButtonNewSong };
foreach (var button in pictureBox2Buttons)
{
button.Visible = isVisible;
if (isVisible)
{
button.BringToFront();
}
}
}
private void NewSongAlertButton_Click(object sender, EventArgs e)
{
2025-08-06 10:47:43 +08:00
//newSongAlertButton.BackgroundImage = newSongAlertActiveBackground;
2025-08-07 13:09:10 +08:00
newSongAlertButton.BackgroundImage= new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_新歌快報(已按).png"));
2025-04-07 16:54:10 +08:00
hotPlayButton.BackgroundImage = hotPlayNormalBackground;
singerSearchButton.BackgroundImage = singerSearchNormalBackground;
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;
guoYuButtonNewSong.BackgroundImage = guoYuNewSongActiveBackground;
taiYuButtonNewSong.BackgroundImage = taiYuNewSongNormalBackground;
yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground;
yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground;
riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground;
hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground;
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);
ToggleNewSongButtonsVisibility();
if (pictureBoxQRCode != null)
{
pictureBoxQRCode.Visible = false;
closeQRCodeButton.Visible = false;
}
}
private void InitializeButtonsForNewSong()
{
guoYuButtonNewSong = new Button{ Text = "", Visible = false };
2025-08-06 10:47:43 +08:00
ResizeAndPositionButton(guoYuButtonNewSong, 1197, 225, 225, 50);
Rectangle guoYuNewSongButtonCropArea = new Rectangle(1197, 225, 225, 50);
2025-08-07 13:09:10 +08:00
guoYuNewSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_國語(未按).png"));
guoYuNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_國語(已按).png"));
2025-04-07 16:54:10 +08:00
guoYuButtonNewSong.BackgroundImage = guoYuNewSongNormalBackground;
guoYuButtonNewSong.BackgroundImageLayout = ImageLayout.Stretch;
guoYuButtonNewSong.FlatStyle = FlatStyle.Flat;
guoYuButtonNewSong.FlatAppearance.BorderSize = 0;
guoYuButtonNewSong.Click += GuoYuButtonNewSong_Click;
this.Controls.Add(guoYuButtonNewSong);
taiYuButtonNewSong = new Button { Text = "", Visible = false };
2025-08-06 10:47:43 +08:00
ResizeAndPositionButton(taiYuButtonNewSong, 1197, 280, 225, 50);
Rectangle taiYuNewSongButtonCropArea = new Rectangle(1197, 280, 225, 50);
2025-08-07 13:09:10 +08:00
taiYuNewSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_台語(未按).png"));
taiYuNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_台語(已按).png"));
2025-04-07 16:54:10 +08:00
taiYuButtonNewSong.BackgroundImage = taiYuNewSongNormalBackground;
taiYuButtonNewSong.BackgroundImageLayout = ImageLayout.Stretch;
taiYuButtonNewSong.FlatStyle = FlatStyle.Flat;
taiYuButtonNewSong.FlatAppearance.BorderSize = 0;
taiYuButtonNewSong.Click += TaiYuButtonNewSong_Click;
this.Controls.Add(taiYuButtonNewSong);
yueYuButtonNewSong = new Button { Text = "", Visible = false };
2025-08-06 10:47:43 +08:00
ResizeAndPositionButton(yueYuButtonNewSong, 1197, 335, 225, 50);
Rectangle yueYuNewSongButtonCropArea = new Rectangle(1197, 335, 225, 50);
2025-08-07 13:09:10 +08:00
yueYuNewSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_粵語(未按).png"));
yueYuNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_粵語(已按).png"));
2025-04-07 16:54:10 +08:00
yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground;
yueYuButtonNewSong.BackgroundImageLayout = ImageLayout.Stretch;
yueYuButtonNewSong.FlatStyle = FlatStyle.Flat;
yueYuButtonNewSong.FlatAppearance.BorderSize = 0;
yueYuButtonNewSong.Click += YueYuButtonNewSong_Click;
this.Controls.Add(yueYuButtonNewSong);
2025-06-17 09:31:00 +08:00
yingWenButtonNewSong = new Button {Visible = false };
2025-04-07 16:54:10 +08:00
2025-08-06 10:47:43 +08:00
ResizeAndPositionButton(yingWenButtonNewSong, 1197, 390, 225, 50);
Rectangle yingWenNewSongButtonCropArea = new Rectangle(1197, 390, 225, 50);
2025-08-07 13:09:10 +08:00
yingWenNewSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_英語(未按).png"));
yingWenNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_英語(已按).png"));
2025-04-07 16:54:10 +08:00
yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground;
yingWenButtonNewSong.BackgroundImageLayout = ImageLayout.Stretch;
yingWenButtonNewSong.FlatStyle = FlatStyle.Flat;
yingWenButtonNewSong.FlatAppearance.BorderSize = 0;
yingWenButtonNewSong.Click += YingWenButtonNewSong_Click;
this.Controls.Add(yingWenButtonNewSong);
2025-06-17 09:31:00 +08:00
riYuButtonNewSong = new Button { Visible = false };
2025-04-07 16:54:10 +08:00
2025-08-06 10:47:43 +08:00
ResizeAndPositionButton(riYuButtonNewSong, 1197, 445, 225, 50);
Rectangle riYuNewSongButtonCropArea = new Rectangle(1197, 445, 225, 50);
2025-08-07 13:09:10 +08:00
riYuNewSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_日語(未按).png"));
riYuNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_日語(已按).png"));
2025-04-07 16:54:10 +08:00
riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground;
riYuButtonNewSong.BackgroundImageLayout = ImageLayout.Stretch;
riYuButtonNewSong.FlatStyle = FlatStyle.Flat;
riYuButtonNewSong.FlatAppearance.BorderSize = 0;
riYuButtonNewSong.Click += RiYuButtonNewSong_Click;
this.Controls.Add(riYuButtonNewSong);
2025-06-17 09:31:00 +08:00
hanYuButtonNewSong = new Button {Visible = false };
2025-04-07 16:54:10 +08:00
2025-08-06 10:47:43 +08:00
ResizeAndPositionButton(hanYuButtonNewSong, 1197, 500, 225, 50);
Rectangle hanYuNewSongButtonCropArea = new Rectangle(1197, 500, 490, 50);
2025-08-07 13:09:10 +08:00
hanYuNewSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_韓語(未按).png"));
hanYuNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_韓語(已按).png"));
2025-04-07 16:54:10 +08:00
hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground;
hanYuButtonNewSong.BackgroundImageLayout = ImageLayout.Stretch;
hanYuButtonNewSong.FlatStyle = FlatStyle.Flat;
hanYuButtonNewSong.FlatAppearance.BorderSize = 0;
hanYuButtonNewSong.Click += HanYuButtonNewSong_Click;
this.Controls.Add(hanYuButtonNewSong);
}
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
}
}