224 lines
11 KiB
C#
224 lines
11 KiB
C#
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)
|
|
{
|
|
|
|
//newSongAlertButton.BackgroundImage = newSongAlertActiveBackground;
|
|
newSongAlertButton.BackgroundImage= new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_新歌快報(已按).png"));
|
|
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;
|
|
/* 清空搜尋欄 */
|
|
ResetinputBox();
|
|
|
|
string query = setQueryforNewSong("國語");
|
|
var guoYuSongs2 = SearchSongs_Mysql(query);
|
|
currentPage = 0;
|
|
totalPages = (int)Math.Ceiling((double)guoYuSongs2.Count / itemsPerPage);
|
|
|
|
multiPagePanel.currentPageIndex = 0;
|
|
multiPagePanel.LoadSongs(guoYuSongs2);
|
|
|
|
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 };
|
|
|
|
ResizeAndPositionButton(guoYuButtonNewSong, 1197, 225, 225, 50);
|
|
Rectangle guoYuNewSongButtonCropArea = new Rectangle(1197, 225, 225, 50);
|
|
guoYuNewSongNormalBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_國語(未按).png"));
|
|
guoYuNewSongActiveBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_國語(已按).png"));
|
|
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 };
|
|
|
|
ResizeAndPositionButton(taiYuButtonNewSong, 1197, 280, 225, 50);
|
|
Rectangle taiYuNewSongButtonCropArea = new Rectangle(1197, 280, 225, 50);
|
|
taiYuNewSongNormalBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_台語(未按).png"));
|
|
taiYuNewSongActiveBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_台語(已按).png"));
|
|
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 };
|
|
|
|
ResizeAndPositionButton(yueYuButtonNewSong, 1197, 335, 225, 50);
|
|
Rectangle yueYuNewSongButtonCropArea = new Rectangle(1197, 335, 225, 50);
|
|
yueYuNewSongNormalBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_粵語(未按).png"));
|
|
yueYuNewSongActiveBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_粵語(已按).png"));
|
|
yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground;
|
|
yueYuButtonNewSong.BackgroundImageLayout = ImageLayout.Stretch;
|
|
yueYuButtonNewSong.FlatStyle = FlatStyle.Flat;
|
|
yueYuButtonNewSong.FlatAppearance.BorderSize = 0;
|
|
|
|
yueYuButtonNewSong.Click += YueYuButtonNewSong_Click;
|
|
|
|
this.Controls.Add(yueYuButtonNewSong);
|
|
|
|
|
|
yingWenButtonNewSong = new Button {Visible = false };
|
|
|
|
ResizeAndPositionButton(yingWenButtonNewSong, 1197, 390, 225, 50);
|
|
Rectangle yingWenNewSongButtonCropArea = new Rectangle(1197, 390, 225, 50);
|
|
yingWenNewSongNormalBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_英語(未按).png"));
|
|
yingWenNewSongActiveBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_英語(已按).png"));
|
|
yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground;
|
|
yingWenButtonNewSong.BackgroundImageLayout = ImageLayout.Stretch;
|
|
yingWenButtonNewSong.FlatStyle = FlatStyle.Flat;
|
|
yingWenButtonNewSong.FlatAppearance.BorderSize = 0;
|
|
|
|
yingWenButtonNewSong.Click += YingWenButtonNewSong_Click;
|
|
|
|
this.Controls.Add(yingWenButtonNewSong);
|
|
|
|
|
|
riYuButtonNewSong = new Button { Visible = false };
|
|
|
|
ResizeAndPositionButton(riYuButtonNewSong, 1197, 445, 225, 50);
|
|
Rectangle riYuNewSongButtonCropArea = new Rectangle(1197, 445, 225, 50);
|
|
riYuNewSongNormalBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_日語(未按).png"));
|
|
riYuNewSongActiveBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_日語(已按).png"));
|
|
riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground;
|
|
riYuButtonNewSong.BackgroundImageLayout = ImageLayout.Stretch;
|
|
riYuButtonNewSong.FlatStyle = FlatStyle.Flat;
|
|
riYuButtonNewSong.FlatAppearance.BorderSize = 0;
|
|
|
|
riYuButtonNewSong.Click += RiYuButtonNewSong_Click;
|
|
|
|
this.Controls.Add(riYuButtonNewSong);
|
|
|
|
|
|
hanYuButtonNewSong = new Button {Visible = false };
|
|
|
|
ResizeAndPositionButton(hanYuButtonNewSong, 1197, 500, 225, 50);
|
|
Rectangle hanYuNewSongButtonCropArea = new Rectangle(1197, 500, 490, 50);
|
|
hanYuNewSongNormalBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_韓語(未按).png"));
|
|
hanYuNewSongActiveBackground = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_韓語(已按).png"));
|
|
hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground;
|
|
hanYuButtonNewSong.BackgroundImageLayout = ImageLayout.Stretch;
|
|
hanYuButtonNewSong.FlatStyle = FlatStyle.Flat;
|
|
hanYuButtonNewSong.FlatAppearance.BorderSize = 0;
|
|
|
|
hanYuButtonNewSong.Click += HanYuButtonNewSong_Click;
|
|
|
|
this.Controls.Add(hanYuButtonNewSong);
|
|
}
|
|
|
|
private string setQueryforNewSong(string category){
|
|
string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY add_date DESC LIMIT 1000;";
|
|
|
|
return query;
|
|
}
|
|
}
|
|
} |