From d36ddd9e906d27056a719a630a3a247159415aeb Mon Sep 17 00:00:00 2001 From: "allen.yan" Date: Tue, 12 Aug 2025 17:11:13 +0800 Subject: [PATCH] =?UTF-8?q?2508121700=201.=E5=9C=96=E7=89=87=E8=B7=AF?= =?UTF-8?q?=E5=BE=91=E9=81=B7=E7=A7=BB=E8=87=B3ini=20=202.=E9=87=8D?= =?UTF-8?q?=E6=A7=8B=EF=BC=8C=E5=8A=9F=E8=83=BD=E9=87=8D=E8=A4=87=E7=9A=84?= =?UTF-8?q?function=E6=B8=85=E7=90=86=20=203.MuiltiPage=E4=BA=BA=E8=81=B2?= =?UTF-8?q?=E5=9C=96=E5=B0=BA=E5=AF=B8=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PrimaryForm.CategorySearch.ChinaSongs.cs | 4 +- .../PrimaryForm.CategorySearch.LoveDuet.cs | 4 +- .../PrimaryForm.CategorySearch.MedleyDance.cs | 3 +- .../PrimaryForm.CategorySearch.Nineties.cs | 3 +- ...imaryForm.CategorySearch.NostalgicSongs.cs | 3 +- .../PrimaryForm.CategorySearch.TalentShow.cs | 3 +- ...maryForm.CategorySearch.VietnameseSongs.cs | 3 +- .../PrimaryForm.CategorySearch.cs | 54 +-- .../PrimaryForm.GroupSearch.GuoYu.cs | 8 +- .../PrimaryForm.GroupSearch.HanYu.cs | 7 +- .../PrimaryForm.GroupSearch.RiYu.cs | 9 +- .../PrimaryForm.GroupSearch.TaiYu.cs | 7 +- .../PrimaryForm.GroupSearch.YingYu.cs | 7 +- .../PrimaryForm.GroupSearch.YueYu.cs | 9 +- .../GroupSearch/PrimaryForm.GroupSearch.cs | 121 ++--- .../HotSong/PrimaryForm.HotSong.cs | 171 ++----- .../PrimaryForm.LanguageSearch.GuoYu.cs | 5 - .../PrimaryForm.LanguageSearch.HanYu.cs | 5 - .../PrimaryForm.LanguageSearch.KeYu.cs | 6 - .../PrimaryForm.LanguageSearch.RiYu.cs | 5 - .../PrimaryForm.LanguageSearch.TaiYu.cs | 5 - .../PrimaryForm.LanguageSearch.YingWen.cs | 5 - .../PrimaryForm.LanguageSearch.YueYu.cs | 5 - .../PrimaryForm.LanguageSearch.cs | 109 ++--- .../NewSongAlert/PrimaryForm.NewSongAlert.cs | 171 ++----- .../PrimaryForm.NewSongAlertCantonese.cs | 7 +- .../PrimaryForm.NewSongAlertChinese.cs | 7 +- .../PrimaryForm.NewSongAlertEnglish.cs | 7 +- .../PrimaryForm.NewSongAlertJapanese.cs | 7 +- .../PrimaryForm.NewSongAlertKorean.cs | 7 +- .../PrimaryForm.NewSongAlertTaiwanese.cs | 7 +- .../PrimaryForm.MultiPagePanel.cs | 8 +- PrimaryFormParts/PrimaryForm.VodScreen.cs | 91 ++-- PrimaryFormParts/PrimaryForm.cs | 451 +++++++++--------- ...PrimaryForm.SingerSearch.BopomofoSearch.cs | 6 +- .../SingerSearch/PrimaryForm.SingerSearch.cs | 37 +- .../PrimaryForm.SongSearch.BopomofoSearch.cs | 7 +- .../SongSearch/PrimaryForm.SongSearch.cs | 81 ++-- 38 files changed, 520 insertions(+), 935 deletions(-) diff --git a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.ChinaSongs.cs b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.ChinaSongs.cs index fd9f3fd..b961d3c 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.ChinaSongs.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.ChinaSongs.cs @@ -4,8 +4,8 @@ namespace DualScreenDemo { private void ChinaSongsButton_Click(object sender, EventArgs e) { - ResetCatBtnStatus(); - chinaSongsButton.BackgroundImage = chinaActiveBackground; + + UpdateCatBtns(chinaSongsButton, chinaActiveBackground); /*chinaSongs = allSongs.Where(song => song.SongGenre.Contains("F1")) .OrderByDescending(song => song.Plays) .ToList();*/ diff --git a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.LoveDuet.cs b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.LoveDuet.cs index 6a57eac..2819df0 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.LoveDuet.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.LoveDuet.cs @@ -4,9 +4,7 @@ namespace DualScreenDemo { private void LoveDuetButton_Click(object sender, EventArgs e) { - - ResetCatBtnStatus(); - loveDuetButton.BackgroundImage = loveDuetActiveBackground; + UpdateCatBtns(loveDuetButton, loveDuetActiveBackground); /*loveDuetSongs = allSongs.Where(song => song.SongGenre.Contains("A1")) .OrderByDescending(song => song.Plays) .ToList();*/ diff --git a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.MedleyDance.cs b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.MedleyDance.cs index 06f24d9..4dc2da4 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.MedleyDance.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.MedleyDance.cs @@ -4,8 +4,7 @@ namespace DualScreenDemo { private void MedleyDanceButton_Click(object sender, EventArgs e) { - ResetCatBtnStatus(); - medleyDanceButton.BackgroundImage = medleyDanceActiveBackground; + UpdateCatBtns(medleyDanceButton, medleyDanceActiveBackground); /*medleyDanceSongs = allSongs.Where(song => song.SongGenre.Contains("C1")) .OrderByDescending(song => song.Plays) .ToList();*/ diff --git a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.Nineties.cs b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.Nineties.cs index c0a5c1a..5c5f4ad 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.Nineties.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.Nineties.cs @@ -4,8 +4,7 @@ namespace DualScreenDemo { private void NinetiesButton_Click(object sender, EventArgs e) { - ResetCatBtnStatus(); - ninetiesButton.BackgroundImage = ninetiesActiveBackground; + UpdateCatBtns(ninetiesButton, ninetiesActiveBackground); /*ninetiesSongs = allSongs.Where(song => song.SongGenre.Contains("D1")) .OrderByDescending(song => song.Plays) .ToList();*/ diff --git a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.NostalgicSongs.cs b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.NostalgicSongs.cs index 4bd2ed5..9ed5935 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.NostalgicSongs.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.NostalgicSongs.cs @@ -4,8 +4,7 @@ namespace DualScreenDemo { private void NostalgicSongsButton_Click(object sender, EventArgs e) { - ResetCatBtnStatus(); - nostalgicSongsButton.BackgroundImage = nostalgicSongsActiveBackground; + UpdateCatBtns(nostalgicSongsButton, nostalgicSongsActiveBackground); /*nostalgicSongs = allSongs.Where(song => song.SongGenre.Contains("E1")) .OrderByDescending(song => song.Plays) .ToList();*/ diff --git a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.TalentShow.cs b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.TalentShow.cs index 3674e55..bd4f421 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.TalentShow.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.TalentShow.cs @@ -4,8 +4,7 @@ namespace DualScreenDemo { private void TalentShowButton_Click(object sender, EventArgs e) { - ResetCatBtnStatus(); - talentShowButton.BackgroundImage = talentShowActiveBackground; + UpdateCatBtns(talentShowButton, talentShowActiveBackground); /*talentShowSongs = allSongs.Where(song => song.SongGenre.Contains("B1")) .OrderByDescending(song => song.Plays) .ToList();*/ diff --git a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.VietnameseSongs.cs b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.VietnameseSongs.cs index 4a05b7f..8d089e8 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.VietnameseSongs.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.VietnameseSongs.cs @@ -4,8 +4,7 @@ namespace DualScreenDemo { private void VietnameseSongsButton_Click(object sender, EventArgs e) { - ResetCatBtnStatus(); - vietnameseSongsButton.BackgroundImage = vietnameseActiveBackground; + UpdateCatBtns(vietnameseSongsButton, vietnameseActiveBackground); /*vietnameseSongs = allSongs.Where(song => song.SongGenre.Contains("G1")) .OrderByDescending(song => song.Plays) .ToList();*/ diff --git a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs index e863625..17fa266 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs @@ -1,5 +1,3 @@ -using System.IO; -using Utils; namespace DualScreenDemo { public partial class PrimaryForm @@ -30,9 +28,8 @@ namespace DualScreenDemo private Bitmap vietnameseNormalBackground; private Bitmap vietnameseActiveBackground; - private void ResetCatBtnStatus() + private void UpdateCatBtns(Button activeButton, Image activeBackground) { - loveDuetButton.BackgroundImage = loveDuetNormalBackground; talentShowButton.BackgroundImage = talentShowNormalBackground; medleyDanceButton.BackgroundImage = medleyDanceNormalBackground; @@ -40,31 +37,14 @@ namespace DualScreenDemo nostalgicSongsButton.BackgroundImage = nostalgicSongsNormalBackground; chinaSongsButton.BackgroundImage = chinaNormalBackground; vietnameseSongsButton.BackgroundImage = vietnameseNormalBackground; + + activeButton.BackgroundImage = activeBackground; } - - //private void InitializeButtonsForCategorySearch() - //{ - // var data=LoadConfigData(); - - // categorySearchNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(未按).png")); - // categorySearchActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(已按).png")); - - // categorySearchButton = new Button { Text = "" }; - // categorySearchButton.Name = "categorySearchButton"; - // ConfigureButton(categorySearchButton, 731, 97, 99, 99, - // categorySearchNormalBackground, - // categorySearchActiveBackground, - // categorySearchActiveBackground, - // CategorySearchButton_Click); - - //} - private void InitializeCategorySearchButtons() { var data = LoadBtnConfigData(); - InitializeButton(ref loveDuetButton, ref loveDuetNormalBackground, ref loveDuetActiveBackground, "loveDuetButton", 1197, 225, 225, 50, data["CategorySubBtn"]["LoveDuetNormal"], data["CategorySubBtn"]["LoveDuetActive"], LoveDuetButton_Click); InitializeButton(ref talentShowButton, ref talentShowNormalBackground, ref talentShowActiveBackground, "talentShowButton", 1197, 280, 225, 50, data["CategorySubBtn"]["TalentNormal"], data["CategorySubBtn"]["TalentActive"], TalentShowButton_Click); @@ -79,19 +59,14 @@ namespace DualScreenDemo InitializeButton(ref vietnameseSongsButton, ref vietnameseNormalBackground, ref vietnameseActiveBackground, "vietnameseSongsButton", 1197, 555, 225, 50, data["CategorySubBtn"]["VietNormal"], data["CategorySubBtn"]["VietActive"], VietnameseSongsButton_Click); - } private void CategorySearchButton_Click(object sender, EventArgs e) { - ResetPrimaryBtnStatus(); + UpdateButtonBackgrounds(categorySearchButton, categorySearchActiveBackground); - categorySearchButton.BackgroundImage = categorySearchActiveBackground; isOnOrderedSongsPage = false; - ResetCatBtnStatus(); - - loveDuetButton.BackgroundImage = loveDuetActiveBackground; /*loveDuetSongs = allSongs.Where(song => song.SongGenre.Contains("A1")) .OrderByDescending(song => song.Plays) @@ -107,7 +82,7 @@ namespace DualScreenDemo multiPagePanel.currentPageIndex = 0; multiPagePanel.LoadSongs(loveDuetSongs); - + SetHotSongButtonsVisibility(false); SetNewSongButtonsVisibility(false); SetSingerSearchButtonsVisibility(false); @@ -124,7 +99,8 @@ namespace DualScreenDemo SetPictureBoxSceneSoundEffectsAndButtonsVisibility(false); SetPictureBoxCategoryAndButtonsVisibility(true); - + UpdateCatBtns(loveDuetButton, loveDuetActiveBackground); + if (pictureBoxQRCode != null) { pictureBoxQRCode.Visible = false; @@ -142,30 +118,30 @@ namespace DualScreenDemo } private void SetPictureBoxCategoryAndButtonsVisibility(bool isVisible) - { + { loveDuetButton.Visible = isVisible; loveDuetButton.BringToFront(); - + talentShowButton.Visible = isVisible; talentShowButton.BringToFront(); - + medleyDanceButton.Visible = isVisible; medleyDanceButton.BringToFront(); - + ninetiesButton.Visible = isVisible; ninetiesButton.BringToFront(); - + nostalgicSongsButton.Visible = isVisible; nostalgicSongsButton.BringToFront(); - + chinaSongsButton.Visible = isVisible; chinaSongsButton.BringToFront(); vietnameseSongsButton.Visible = isVisible; vietnameseSongsButton.BringToFront(); - - + + } private string SetQueryforSQL(string contains){ diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.GuoYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.GuoYu.cs index 4107257..5ed28e6 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.GuoYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.GuoYu.cs @@ -4,12 +4,8 @@ namespace DualScreenDemo { private void GroupGuoYuButton_Click(object sender, EventArgs e) { - groupGuoYuButton.BackgroundImage = groupGuoYuActiveBackground; - groupTaiYuButton.BackgroundImage = groupTaiYuNormalBackground; - groupYueYuButton.BackgroundImage = groupYueYuNormalBackground; - groupYingWenButton.BackgroundImage = groupYingWenNormalBackground; - groupRiYuButton.BackgroundImage = groupRiYuNormalBackground; - groupHanYuButton.BackgroundImage = groupHanYuNormalBackground; + + UpdateGroupSubBtns(groupGuoYuButton, groupGuoYuActiveBackground); /*guoYuSongs = allSongs.Where(song => song.Category == "國語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.HanYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.HanYu.cs index ee0bac5..4cfac52 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.HanYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.HanYu.cs @@ -4,12 +4,7 @@ namespace DualScreenDemo { private void GroupHanYuButton_Click(object sender, EventArgs e) { - groupGuoYuButton.BackgroundImage = groupGuoYuNormalBackground; - groupTaiYuButton.BackgroundImage = groupTaiYuNormalBackground; - groupYueYuButton.BackgroundImage = groupYueYuNormalBackground; - groupYingWenButton.BackgroundImage = groupYingWenNormalBackground; - groupRiYuButton.BackgroundImage = groupRiYuNormalBackground; - groupHanYuButton.BackgroundImage = groupHanYuActiveBackground; + UpdateGroupSubBtns(groupHanYuButton, groupHanYuActiveBackground); /*hanYuSongs = allSongs.Where(song => song.Category == "韓語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.RiYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.RiYu.cs index 1f097b4..5c028ac 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.RiYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.RiYu.cs @@ -4,17 +4,12 @@ namespace DualScreenDemo { private void GroupRiYuButton_Click(object sender, EventArgs e) { - groupGuoYuButton.BackgroundImage = groupGuoYuNormalBackground; - groupTaiYuButton.BackgroundImage = groupTaiYuNormalBackground; - groupYueYuButton.BackgroundImage = groupYueYuNormalBackground; - groupYingWenButton.BackgroundImage = groupYingWenNormalBackground; - groupRiYuButton.BackgroundImage = groupRiYuActiveBackground; - groupHanYuButton.BackgroundImage = groupHanYuNormalBackground; + UpdateGroupSubBtns(groupRiYuButton, groupRiYuActiveBackground); /*riYuSongs = allSongs.Where(song => song.Category == "日語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) .ToList();*/ - + string query = "SELECT * FROM song_library_cache WHERE language_name = '日語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_counts DESC;"; var riYuSongs = SearchSongs_Mysql(query); currentPage = 0; diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.TaiYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.TaiYu.cs index f5ba646..a8d4355 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.TaiYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.TaiYu.cs @@ -4,12 +4,7 @@ namespace DualScreenDemo { private void GroupTaiYuButton_Click(object sender, EventArgs e) { - groupGuoYuButton.BackgroundImage = groupGuoYuNormalBackground; - groupTaiYuButton.BackgroundImage = groupTaiYuActiveBackground; - groupYueYuButton.BackgroundImage = groupYueYuNormalBackground; - groupYingWenButton.BackgroundImage = groupYingWenNormalBackground; - groupRiYuButton.BackgroundImage = groupRiYuNormalBackground; - groupHanYuButton.BackgroundImage = groupHanYuNormalBackground; + UpdateGroupSubBtns(groupTaiYuButton, groupTaiYuActiveBackground); /*taiYuSongs = allSongs.Where(song => song.Category == "台語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YingYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YingYu.cs index e4891e8..7bc8ae1 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YingYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YingYu.cs @@ -4,12 +4,7 @@ namespace DualScreenDemo { private void GroupYingWenButton_Click(object sender, EventArgs e) { - groupGuoYuButton.BackgroundImage = groupGuoYuNormalBackground; - groupTaiYuButton.BackgroundImage = groupTaiYuNormalBackground; - groupYueYuButton.BackgroundImage = groupYueYuNormalBackground; - groupYingWenButton.BackgroundImage = groupYingWenActiveBackground; - groupRiYuButton.BackgroundImage = groupRiYuNormalBackground; - groupHanYuButton.BackgroundImage = groupHanYuNormalBackground; + UpdateGroupSubBtns(groupYingWenButton, groupYingWenActiveBackground); /*yingWenSongs = allSongs.Where(song => song.Category == "英語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YueYu.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YueYu.cs index 1758035..927a6fe 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YueYu.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.YueYu.cs @@ -4,17 +4,12 @@ namespace DualScreenDemo { private void GroupYueYuButton_Click(object sender, EventArgs e) { - groupGuoYuButton.BackgroundImage = groupGuoYuNormalBackground; - groupTaiYuButton.BackgroundImage = groupTaiYuNormalBackground; - groupYueYuButton.BackgroundImage = groupYueYuActiveBackground; - groupYingWenButton.BackgroundImage = groupYingWenNormalBackground; - groupRiYuButton.BackgroundImage = groupRiYuNormalBackground; - groupHanYuButton.BackgroundImage = groupHanYuNormalBackground; + UpdateGroupSubBtns(groupYueYuButton, groupYueYuActiveBackground); /*yueYuSongs = allSongs.Where(song => song.Category == "粵語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) .ToList();*/ - + string query = "SELECT * FROM song_library_cache WHERE language_name = '粵語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_counts DESC;"; var yueYuSongs = SearchSongs_Mysql(query); currentPage = 0; diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs index 35f7eaf..e513b74 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs @@ -1,5 +1,3 @@ -using System.IO; - namespace DualScreenDemo { public partial class PrimaryForm @@ -27,108 +25,46 @@ namespace DualScreenDemo private Bitmap groupHanYuNormalBackground; private Bitmap groupHanYuActiveBackground; + + private void UpdateGroupSubBtns(Button activeButton, Image activeBackground) + { + groupGuoYuButton.BackgroundImage = groupGuoYuNormalBackground; + groupTaiYuButton.BackgroundImage = groupTaiYuNormalBackground; + groupYueYuButton.BackgroundImage = groupYueYuNormalBackground; + groupYingWenButton.BackgroundImage = groupYingWenNormalBackground; + groupRiYuButton.BackgroundImage = groupRiYuNormalBackground; + groupHanYuButton.BackgroundImage = groupHanYuNormalBackground; + + activeButton.BackgroundImage = activeBackground; + } + private void InitializeButtonsForGroupPictureBox() { - - groupGuoYuButton = new Button { Text = "", Visible = false }; - ResizeAndPositionButton(groupGuoYuButton, 1197, 225, 225, 50); - Rectangle groupGuoYuButtonCropArea = new Rectangle(1197, 225, 225, 50); - groupGuoYuNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_國語(未按).png")); - groupGuoYuActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_國語(已按).png")); - groupGuoYuButton.BackgroundImage = groupGuoYuNormalBackground; - groupGuoYuButton.BackgroundImageLayout = ImageLayout.Stretch; - groupGuoYuButton.FlatStyle = FlatStyle.Flat; - groupGuoYuButton.FlatAppearance.BorderSize = 0; - groupGuoYuButton.Click += GroupGuoYuButton_Click; - this.Controls.Add(groupGuoYuButton); + var data = LoadBtnConfigData(); - - groupTaiYuButton = new Button { Text = "", Visible = false }; - ResizeAndPositionButton(groupTaiYuButton, 1197, 280, 225, 50); - Rectangle groupTaiYuButtonCropArea = new Rectangle(1197, 280, 225, 50); - groupTaiYuNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_台語(未按).png")); - groupTaiYuActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_台語(已按).png")); - groupTaiYuButton.BackgroundImage = groupTaiYuNormalBackground; - groupTaiYuButton.BackgroundImageLayout = ImageLayout.Stretch; - groupTaiYuButton.FlatStyle = FlatStyle.Flat; - groupTaiYuButton.FlatAppearance.BorderSize = 0; - groupTaiYuButton.Click += GroupTaiYuButton_Click; - this.Controls.Add(groupTaiYuButton); - - groupYueYuButton = new Button { Text = "", Visible = false }; - ResizeAndPositionButton(groupYueYuButton, 1197, 335, 225, 50); - Rectangle groupYueYuButtonCropArea = new Rectangle(1197, 335, 225, 50); - groupYueYuNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_粵語(未按).png")); - groupYueYuActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_粵語(已按).png")); - groupYueYuButton.BackgroundImage = groupYueYuNormalBackground; - groupYueYuButton.BackgroundImageLayout = ImageLayout.Stretch; - groupYueYuButton.FlatStyle = FlatStyle.Flat; - groupYueYuButton.FlatAppearance.BorderSize = 0; - groupYueYuButton.Click += GroupYueYuButton_Click; - this.Controls.Add(groupYueYuButton); + InitializeButton(ref groupGuoYuButton, ref groupGuoYuNormalBackground, ref groupGuoYuActiveBackground, "groupGuoYuButton", 1197, 225, 225, 50, data["GroupSubBtn"]["GuoYuNormal"], data["GroupSubBtn"]["GuoYuActive"], GroupGuoYuButton_Click); - - groupYingWenButton = new Button { Text = "", Visible = false }; - ResizeAndPositionButton(groupYingWenButton, 1197, 390, 225, 50); - Rectangle groupYingWenButtonCropArea = new Rectangle(1197, 390, 225, 50); - groupYingWenNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_英語(未按).png")); - groupYingWenActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_英語(已按).png")); - groupYingWenButton.BackgroundImage = groupYingWenNormalBackground; - groupYingWenButton.BackgroundImageLayout = ImageLayout.Stretch; - groupYingWenButton.FlatStyle = FlatStyle.Flat; - groupYingWenButton.FlatAppearance.BorderSize = 0; - groupYingWenButton.Click += GroupYingWenButton_Click; - this.Controls.Add(groupYingWenButton); + InitializeButton(ref groupTaiYuButton, ref groupTaiYuNormalBackground, ref groupTaiYuActiveBackground, "groupTaiYuButton", 1197, 280, 225, 50, data["GroupSubBtn"]["TaiYuNormal"], data["GroupSubBtn"]["TaiYuActive"], GroupTaiYuButton_Click); - - groupRiYuButton = new Button { Text = "", Visible = false }; - ResizeAndPositionButton(groupRiYuButton, 1197, 445, 225, 50); - Rectangle groupRiYuButtonCropArea = new Rectangle(1197, 445, 225, 50); - groupRiYuNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_日語(未按).png")); - groupRiYuActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_日語(已按).png")); - groupRiYuButton.BackgroundImage = groupRiYuNormalBackground; - groupRiYuButton.BackgroundImageLayout = ImageLayout.Stretch; - groupRiYuButton.FlatStyle = FlatStyle.Flat; - groupRiYuButton.FlatAppearance.BorderSize = 0; - groupRiYuButton.Click += GroupRiYuButton_Click; - this.Controls.Add(groupRiYuButton); + InitializeButton(ref groupYueYuButton, ref groupYueYuNormalBackground, ref groupYueYuActiveBackground, "groupYueYuButton", 1197, 335, 225, 50, data["GroupSubBtn"]["YueYuNormal"], data["GroupSubBtn"]["YueYuActive"], GroupYueYuButton_Click); + + InitializeButton(ref groupYingWenButton, ref groupYingWenNormalBackground, ref groupYingWenActiveBackground, "groupYingWenButton", 1197, 390, 225, 50, data["GroupSubBtn"]["YingWenNormal"], data["GroupSubBtn"]["YingWenActive"], GroupYingWenButton_Click); + + InitializeButton(ref groupRiYuButton, ref groupRiYuNormalBackground, ref groupRiYuActiveBackground, "groupRiYuButton", 1197, 445, 225, 50, data["GroupSubBtn"]["RiYuNormal"], data["GroupSubBtn"]["RiYuActive"], GroupRiYuButton_Click); + + InitializeButton(ref groupHanYuButton, ref groupHanYuNormalBackground, ref groupHanYuActiveBackground, "groupHanYuButton", 1197, 500, 225, 50, data["GroupSubBtn"]["HanYuNormal"], data["GroupSubBtn"]["HanYuActive"], GroupHanYuButton_Click); - - groupHanYuButton = new Button { Text = "", Visible = false }; - ResizeAndPositionButton(groupHanYuButton, 1197, 500, 225, 50); - Rectangle groupHanYuButtonCropArea = new Rectangle(1197, 500, 225, 50); - groupHanYuNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_韓語(未按).png")); - groupHanYuActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\6.團體查詢_韓語(已按).png")); - groupHanYuButton.BackgroundImage = groupHanYuNormalBackground; - groupHanYuButton.BackgroundImageLayout = ImageLayout.Stretch; - groupHanYuButton.FlatStyle = FlatStyle.Flat; - groupHanYuButton.FlatAppearance.BorderSize = 0; - groupHanYuButton.Click += GroupHanYuButton_Click; - this.Controls.Add(groupHanYuButton); } + private void GroupSongSelectionButton_Click(object sender, EventArgs e) { - newSongAlertButton.BackgroundImage = newSongAlertNormalBackground; - hotPlayButton.BackgroundImage = hotPlayNormalBackground; - singerSearchButton.BackgroundImage = singerSearchNormalBackground; - songSearchButton.BackgroundImage = songSearchNormalBackground; - languageSearchButton.BackgroundImage = languageSearchNormalBackground; - groupSearchButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_合唱查詢(已按).png")); - categorySearchButton.BackgroundImage = categorySearchNormalBackground; - orderedSongsButton.BackgroundImage = orderedSongsNormalBackground; - myFavoritesButton.BackgroundImage = myFavoritesNormalBackground; - promotionsButton.BackgroundImage = promotionsNormalBackground; - deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground; + UpdateButtonBackgrounds(groupSearchButton, groupSearchActiveBackground); + isOnOrderedSongsPage = false; - groupGuoYuButton.BackgroundImage = groupGuoYuActiveBackground; - groupTaiYuButton.BackgroundImage = groupTaiYuNormalBackground; - groupYueYuButton.BackgroundImage = groupYueYuNormalBackground; - groupYingWenButton.BackgroundImage = groupYingWenNormalBackground; - groupRiYuButton.BackgroundImage = groupRiYuNormalBackground; - groupHanYuButton.BackgroundImage = groupHanYuNormalBackground; + /*guoYuSongs = allSongs.Where(song => song.Category == "國語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團")) .OrderByDescending(song => song.Plays) @@ -161,7 +97,8 @@ namespace DualScreenDemo SetPictureBoxSceneSoundEffectsAndButtonsVisibility(false); SetGroupButtonsVisibility(true); - + UpdateGroupSubBtns(groupGuoYuButton, groupGuoYuActiveBackground); + if (pictureBoxQRCode != null) { pictureBoxQRCode.Visible = false; diff --git a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs index 6b48948..ce5ea1e 100644 --- a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs +++ b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs @@ -1,12 +1,11 @@ -using System.IO; using DBObj; namespace DualScreenDemo { public partial class PrimaryForm { private Button hotPlayButton; - private Bitmap hotPlayNormalBackground; - private Bitmap hotPlayActiveBackground; + private Bitmap hotPlayNormalBackground; + private Bitmap hotPlayActiveBackground; private Button guoYuButtonHotSong; private Bitmap guoYuHotSongNormalBackground; @@ -31,56 +30,71 @@ namespace DualScreenDemo private Bitmap hanYuHotSongActiveBackground; + + private void UpdateHotSongButtons(Button activeButton, Image activeBackground) + { + guoYuButtonHotSong.BackgroundImage = guoYuHotSongNormalBackground; + taiYuButtonHotSong.BackgroundImage = taiYuHotSongNormalBackground; + taiYuNewSongButtonHotSong.BackgroundImage = taiYuNewSongHotSongNormalBackground; + guoYuNewSongButtonHotSong.BackgroundImage = guoYuNewSongHotSongNormalBackground; + yingWenButtonHotSong.BackgroundImage = yingWenHotSongNormalBackground; + riYuButtonHotSong.BackgroundImage = riYuHotSongNormalBackground; + hanYuButtonHotSong.BackgroundImage = hanYuHotSongNormalBackground; + + activeButton.BackgroundImage = activeBackground; + } + + + private void InitializeButtonsForHotSong() + { + var data = LoadBtnConfigData(); + + InitializeButton(ref guoYuNewSongButtonHotSong, ref guoYuNewSongHotSongNormalBackground, ref guoYuNewSongHotSongActiveBackground, "guoYuNewSongButtonHotSong", 1197, 225, 225, 50, data["HotSongSubBtn"]["GuoYuNewNormal"], data["HotSongSubBtn"]["GuoYuNewActive"], GuoYuNewSongButtonHotSong_Click); + + InitializeButton(ref taiYuNewSongButtonHotSong, ref taiYuNewSongHotSongNormalBackground, ref taiYuNewSongHotSongActiveBackground, "taiYuNewSongButtonHotSong", 1197, 280, 225, 50, data["HotSongSubBtn"]["TaiYuNewNormal"], data["HotSongSubBtn"]["TaiYuNewActive"], TaiYuNewSongButtonHotSong_Click); + + InitializeButton(ref taiYuButtonHotSong, ref taiYuHotSongNormalBackground, ref taiYuHotSongActiveBackground, "taiYuButtonHotSong", 1197, 335, 225, 50, data["HotSongSubBtn"]["TaiYuHotNormal"], data["HotSongSubBtn"]["TaiYuHotActive"], TaiYuButtonHotSong_Click); + + InitializeButton(ref guoYuButtonHotSong, ref guoYuHotSongNormalBackground, ref guoYuHotSongActiveBackground, "guoYuButtonHotSong", 1197, 390, 225, 50, data["HotSongSubBtn"]["GuoYuHotNormal"], data["HotSongSubBtn"]["GuoYuHotActive"], GuoYuButtonHotSong_Click); + + InitializeButton(ref yingWenButtonHotSong, ref yingWenHotSongNormalBackground, ref yingWenHotSongActiveBackground, "yingWenButtonHotSong", 1197, 445, 225, 50, data["HotSongSubBtn"]["EngHotNormal"], data["HotSongSubBtn"]["EngHotActive"], YingWenButtonHotSong_Click); + + InitializeButton(ref riYuButtonHotSong, ref riYuHotSongNormalBackground, ref riYuHotSongActiveBackground, "riYuButtonHotSong", 1197, 500, 225, 50, data["HotSongSubBtn"]["JapHotNormal"], data["HotSongSubBtn"]["JapHotActive"], RiYuButtonHotSong_Click); + + InitializeButton(ref hanYuButtonHotSong, ref hanYuHotSongNormalBackground, ref hanYuHotSongActiveBackground, "hanYuButtonHotSong", 1197, 555, 225, 50, data["HotSongSubBtn"]["KrHotNormal"], data["HotSongSubBtn"]["KrHotActive"], HanYuButtonHotSong_Click); + + } + private void SetHotSongButtonsVisibility(bool isVisible) { - - - Button[] hotSongButtons = { guoYuButtonHotSong, taiYuButtonHotSong, taiYuNewSongButtonHotSong, guoYuNewSongButtonHotSong, yingWenButtonHotSong, riYuButtonHotSong, hanYuButtonHotSong }; - foreach (var button in hotSongButtons) { button.Visible = isVisible; - - if (isVisible) { button.BringToFront(); } } + } public void HotPlayButton_Click(object sender, EventArgs e) { - UpdateButtonBackgrounds(hotPlayButton, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_熱門排行(已按).png"))); - UpdateHotSongButtons(guoYuButtonHotSong, guoYuHotSongActiveBackground); + UpdateButtonBackgrounds(hotPlayButton, hotPlayActiveBackground); + isOnOrderedSongsPage = false; /* 清空搜尋欄 */ ResetinputBox(); string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `song_counts` DESC LIMIT 1000;"; var guoYuSongs = SearchSongs_Mysql(query); UpdateSongList(guoYuSongs); - - SetButtonsVisibility(); - //HideQRCode(); - } - private void UpdateButtonBackgrounds(Button activeButton, Image activeBackground) - { - newSongAlertButton.BackgroundImage = newSongAlertNormalBackground; - 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; - activeButton.BackgroundImage = activeBackground; + SetButtonsVisibility(); + UpdateHotSongButtons(guoYuNewSongButtonHotSong, guoYuNewSongHotSongActiveBackground); + //HideQRCode(); } private void OnHotSongButtonClick(Button activeButton, Bitmap activeBackground, string category) @@ -93,25 +107,12 @@ namespace DualScreenDemo UpdateSongList(selectedSongs); } - private void UpdateHotSongButtons(Button activeButton, Image activeBackground) - { - guoYuButtonHotSong.BackgroundImage = guoYuHotSongNormalBackground; - taiYuButtonHotSong.BackgroundImage = taiYuHotSongNormalBackground; - taiYuNewSongButtonHotSong.BackgroundImage = taiYuNewSongHotSongNormalBackground; - guoYuNewSongButtonHotSong.BackgroundImage = guoYuNewSongHotSongNormalBackground; - yingWenButtonHotSong.BackgroundImage = yingWenHotSongNormalBackground; - riYuButtonHotSong.BackgroundImage = riYuHotSongNormalBackground; - hanYuButtonHotSong.BackgroundImage = hanYuHotSongNormalBackground; - - activeButton.BackgroundImage = activeBackground; - } - private void UpdateSongList(List songs) { - currentPage = 0; + currentPage = 0; totalPages = (int)Math.Ceiling((double)songs.Count / itemsPerPage); - + multiPagePanel.currentPageIndex = 0; multiPagePanel.LoadSongs(songs); } @@ -141,89 +142,7 @@ namespace DualScreenDemo closeQRCodeButton.Visible = false; } - private void InitializeButtonsForHotSong() - { - InitializeHotSongButton(ref guoYuNewSongButtonHotSong, "國語新歌", 1197, 225, 225, 50, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_國語新歌排行(未按).png")), - out guoYuNewSongHotSongNormalBackground, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_國語新歌排行(已按).png")), - out guoYuNewSongHotSongActiveBackground, - GuoYuNewSongButtonHotSong_Click); - - InitializeHotSongButton(ref taiYuNewSongButtonHotSong, "台語新歌", 1197, 280, 225, 50, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_台語新歌排行(未按).png")), - out taiYuNewSongHotSongNormalBackground, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_台語新歌排行(已按).png")), - out taiYuNewSongHotSongActiveBackground, - TaiYuNewSongButtonHotSong_Click); - - - InitializeHotSongButton(ref taiYuButtonHotSong, "台語", 1197, 335, 225, 50, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_台語人氣排行(未按).png")), - out taiYuHotSongNormalBackground, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_台語人氣排行(已按).png")), - out taiYuHotSongActiveBackground, - TaiYuButtonHotSong_Click); - - - InitializeHotSongButton(ref guoYuButtonHotSong, "國語", 1197, 390, 225, 50, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_國語人氣排行(未按).png")), - out guoYuHotSongNormalBackground, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_國語人氣排行(已按).png")), - out guoYuHotSongActiveBackground, - GuoYuButtonHotSong_Click); - - InitializeHotSongButton(ref yingWenButtonHotSong, "英文", 1197, 445, 225, 50, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_英語人氣排行(未按).png")), - out yingWenHotSongNormalBackground, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_英語人氣排行(已按).png")), - out yingWenHotSongActiveBackground, - YingWenButtonHotSong_Click); - - InitializeHotSongButton(ref riYuButtonHotSong, "日語", 1197, 500, 225, 50, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_日語人氣排行(未按).png")), - out riYuHotSongNormalBackground, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_日語人氣排行(已按).png")), - out riYuHotSongActiveBackground, - RiYuButtonHotSong_Click); - - InitializeHotSongButton(ref hanYuButtonHotSong, "韓語", 1197, 555, 225, 50, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_韓語人氣排行(未按).png")), - out hanYuHotSongNormalBackground, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\2.熱門排行_韓語人氣排行(已按).png")), - out hanYuHotSongActiveBackground, - HanYuButtonHotSong_Click); - - } - - private void InitializeHotSongButton(ref Button button, string buttonText, int x, int y, int width, int height, - Image normalBackground, out Bitmap normalBackgroundOut, - Image activeBackground, out Bitmap activeBackgroundOut, - EventHandler clickEventHandler) - { - button = new Button { - Text = "", // 移除文字 - Visible = false - }; - ResizeAndPositionButton(button, x, y, width, height); - - // 修改裁剪區域,避開文字部分 - Rectangle cropArea = new Rectangle(1214, y, 209, 58); // 使用固定的裁剪區域 - - //normalBackgroundOut = new Bitmap(normalBackground).Clone(cropArea, normalBackground.PixelFormat); - //activeBackgroundOut = new Bitmap(activeBackground).Clone(cropArea, activeBackground.PixelFormat); - - normalBackgroundOut = new Bitmap(normalBackground); - activeBackgroundOut = new Bitmap(activeBackground); - - button.BackgroundImage = normalBackgroundOut; - button.BackgroundImageLayout = ImageLayout.Stretch; - button.FlatStyle = FlatStyle.Flat; - button.FlatAppearance.BorderSize = 0; - button.Click += clickEventHandler; - this.Controls.Add(button); - } } } \ No newline at end of file diff --git a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.GuoYu.cs b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.GuoYu.cs index 19ccdb8..16661d8 100644 --- a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.GuoYu.cs +++ b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.GuoYu.cs @@ -4,11 +4,6 @@ namespace DualScreenDemo { public partial class PrimaryForm { - private void InitializeGuoYuButton() - { - Rectangle guoYuButtonCropArea = new Rectangle(1197, 225, 225, 20); - InitializeButton(ref guoYuButton, "國語", 1197, 225, 225, 50, guoYuButtonCropArea, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_國語(未按).png")), out guoYuNormalBackground, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_國語(已按).png")), out guoYuActiveBackground, GuoYuButton_Click); - } private void GuoYuButton_Click(object sender, EventArgs e) { diff --git a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.HanYu.cs b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.HanYu.cs index f0f7247..544c698 100644 --- a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.HanYu.cs +++ b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.HanYu.cs @@ -4,11 +4,6 @@ namespace DualScreenDemo { public partial class PrimaryForm { - private void InitializeHanYuButton() - { - Rectangle hanYuButtonCropArea = new Rectangle(1197, 500, 225, 50); - InitializeButton(ref hanYuButton, "韓語", 1197, 500, 225, 50, hanYuButtonCropArea, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_韓語(未按).png")), out hanYuNormalBackground, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_韓語(已按).png")), out hanYuActiveBackground, HanYuButton_Click); - } private void HanYuButton_Click(object sender, EventArgs e) { diff --git a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.KeYu.cs b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.KeYu.cs index fc118e3..c618235 100644 --- a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.KeYu.cs +++ b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.KeYu.cs @@ -4,12 +4,6 @@ namespace DualScreenDemo { public partial class PrimaryForm { - private void InitializeKeYuButton() - { - Rectangle keYuButtonCropArea = new Rectangle(1197, 555, 225, 50); - InitializeButton(ref keYuButton, "客語", 1197, 555, 225, 50, keYuButtonCropArea, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_客語(未按).png")), out keYuNormalBackground, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_客語(已按).png")), out keYuActiveBackground, KeYuButton_Click); - } - private void KeYuButton_Click(object sender, EventArgs e) { OnLanguageButtonClick(keYuButton, keYuActiveBackground, "客語"); diff --git a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.RiYu.cs b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.RiYu.cs index 78c2d59..7a386d7 100644 --- a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.RiYu.cs +++ b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.RiYu.cs @@ -4,11 +4,6 @@ namespace DualScreenDemo { public partial class PrimaryForm { - private void InitializeRiYuButton() - { - Rectangle riYuButtonCropArea = new Rectangle(1197, 445, 225, 50); - InitializeButton(ref riYuButton, "日語", 1197, 445, 225, 50, riYuButtonCropArea, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_日語(未按).png")), out riYuNormalBackground, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_日語(已按).png")), out riYuActiveBackground, RiYuButton_Click); - } private void RiYuButton_Click(object sender, EventArgs e) { diff --git a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.TaiYu.cs b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.TaiYu.cs index bb89781..4af3ceb 100644 --- a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.TaiYu.cs +++ b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.TaiYu.cs @@ -4,11 +4,6 @@ namespace DualScreenDemo { public partial class PrimaryForm { - private void InitializeTaiYuButton() - { - Rectangle taiYuButtonCropArea = new Rectangle(1197, 280, 225, 50); - InitializeButton(ref taiYuButton, "台語", 1197, 280, 225, 50, taiYuButtonCropArea, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_台語(未按).png")), out taiYuNormalBackground, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_台語(已按).png")), out taiYuActiveBackground, TaiYuButton_Click); - } private void TaiYuButton_Click(object sender, EventArgs e) { diff --git a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.YingWen.cs b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.YingWen.cs index 00d63de..f6902e6 100644 --- a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.YingWen.cs +++ b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.YingWen.cs @@ -4,11 +4,6 @@ namespace DualScreenDemo { public partial class PrimaryForm { - private void InitializeYingWenButton() - { - Rectangle yingWenButtonCropArea = new Rectangle(1197, 390, 225, 50); - InitializeButton(ref yingWenButton, "英文", 1197, 390, 225, 50, yingWenButtonCropArea, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_英語(未按).png")), out yingWenNormalBackground, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_英語(已按).png")), out yingWenActiveBackground, YingWenButton_Click); - } private void YingWenButton_Click(object sender, EventArgs e) { diff --git a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.YueYu.cs b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.YueYu.cs index 289cbaa..92ec886 100644 --- a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.YueYu.cs +++ b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.YueYu.cs @@ -4,11 +4,6 @@ namespace DualScreenDemo { public partial class PrimaryForm { - private void InitializeYueYuButton() - { - Rectangle yueYuButtonCropArea = new Rectangle(1197, 335, 225, 50); - InitializeButton(ref yueYuButton, "粵語", 1197, 335, 225, 50, yueYuButtonCropArea, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_粵語(未按).png")), out yueYuNormalBackground, new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\5.語別查詢_粵語(已按).png")), out yueYuActiveBackground, YueYuButton_Click); - } private void YueYuButton_Click(object sender, EventArgs e) { diff --git a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs index 13b5853..db41bec 100644 --- a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs +++ b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs @@ -1,29 +1,11 @@ using DBObj; using MySqlConnector; using System.Globalization; -using System.IO; namespace DualScreenDemo { public partial class PrimaryForm - { - - private void InitializeButton(ref Button button, string buttonText, int x, int y, int width, int height, Rectangle cropArea, Image normalBackground, out Bitmap normalBackgroundOut, Image activeBackground, out Bitmap activeBackgroundOut, EventHandler clickEventHandler) - { - button = new Button { Text = "", Visible = false }; - ResizeAndPositionButton(button, x, y, width, height); - //normalBackgroundOut = new Bitmap(normalBackground).Clone(cropArea, normalBackground.PixelFormat); - //activeBackgroundOut = new Bitmap(activeBackground).Clone(cropArea, activeBackground.PixelFormat); - normalBackgroundOut = new Bitmap(normalBackground); - activeBackgroundOut = new Bitmap(activeBackground); - button.BackgroundImage = normalBackgroundOut; - button.BackgroundImageLayout = ImageLayout.Stretch; - button.FlatStyle = FlatStyle.Flat; - button.FlatAppearance.BorderSize = 0; - button.Click += clickEventHandler; - this.Controls.Add(button); - } - + { private Button languageSearchButton; private Bitmap languageSearchNormalBackground; private Bitmap languageSearchActiveBackground; @@ -49,25 +31,10 @@ namespace DualScreenDemo private Button keYuButton; private Bitmap keYuNormalBackground; private Bitmap keYuActiveBackground; - - // 語別查詢 query LIMIT 100 可更改 - private void LanguageSongSelectionButton_Click(object sender, EventArgs e) + private void UpdateLangBtns(Button activeButton, Image activeBackground) { - newSongAlertButton.BackgroundImage = newSongAlertNormalBackground; - hotPlayButton.BackgroundImage = hotPlayNormalBackground; - singerSearchButton.BackgroundImage = singerSearchNormalBackground; - songSearchButton.BackgroundImage = songSearchNormalBackground; - languageSearchButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_語別查詢(已按).png")); - groupSearchButton.BackgroundImage = groupSearchNormalBackground; - categorySearchButton.BackgroundImage = categorySearchNormalBackground; - orderedSongsButton.BackgroundImage = orderedSongsNormalBackground; - myFavoritesButton.BackgroundImage = myFavoritesNormalBackground; - promotionsButton.BackgroundImage = promotionsNormalBackground; - deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground; - isOnOrderedSongsPage = false; - - guoYuButton.BackgroundImage = guoYuActiveBackground; + guoYuButton.BackgroundImage = guoYuNormalBackground; taiYuButton.BackgroundImage = taiYuNormalBackground; yueYuButton.BackgroundImage = yueYuNormalBackground; yingWenButton.BackgroundImage = yingWenNormalBackground; @@ -75,6 +42,37 @@ namespace DualScreenDemo hanYuButton.BackgroundImage = hanYuNormalBackground; keYuButton.BackgroundImage = keYuNormalBackground; + activeButton.BackgroundImage = activeBackground; + } + + private void InitializeLangSearchButtons() + { + var data = LoadBtnConfigData(); + + + InitializeButton(ref guoYuButton, ref guoYuNormalBackground, ref guoYuActiveBackground, "guoYuButton", 1197, 225, 225, 50, data["LangSearchSubBtn"]["GuoYuLangNormal"], data["LangSearchSubBtn"]["GuoYuLangActive"], GuoYuButton_Click); + + InitializeButton(ref taiYuButton, ref taiYuNormalBackground, ref taiYuActiveBackground, "taiYuButton", 1197, 280, 225, 50, data["LangSearchSubBtn"]["TaiYuLangNormal"], data["LangSearchSubBtn"]["TaiYuLangActive"], TaiYuButton_Click); + + InitializeButton(ref yueYuButton, ref yueYuNormalBackground, ref yueYuActiveBackground, "yueYuButton", 1197, 335, 225, 50, data["LangSearchSubBtn"]["YueYuLangNormal"], data["LangSearchSubBtn"]["YueYuLangActive"], YueYuButton_Click); + + InitializeButton(ref yingWenButton, ref yingWenNormalBackground, ref yingWenActiveBackground, "yingWenButton", 1197, 390, 225, 50, data["LangSearchSubBtn"]["EngLangNormal"], data["LangSearchSubBtn"]["EngLangActive"], YingWenButton_Click); + + InitializeButton(ref riYuButton, ref riYuNormalBackground, ref riYuActiveBackground, "riYuButton", 1197, 445, 225, 50, data["LangSearchSubBtn"]["JapLangNormal"], data["LangSearchSubBtn"]["JapLangActive"], RiYuButton_Click); + + InitializeButton(ref hanYuButton, ref hanYuNormalBackground, ref hanYuActiveBackground, "hanYuButton", 1197, 500, 225, 50, data["LangSearchSubBtn"]["KrLangNormal"], data["LangSearchSubBtn"]["KrLangActive"], HanYuButton_Click); + + InitializeButton(ref keYuButton, ref keYuNormalBackground, ref keYuActiveBackground, "keYuButton", 1197, 555, 225, 50, data["LangSearchSubBtn"]["KeYuLangNormal"], data["LangSearchSubBtn"]["KeYuLangActive"], KeYuButton_Click); + + } + + private void LanguageSongSelectionButton_Click(object sender, EventArgs e) + { + + UpdateButtonBackgrounds(languageSearchButton, languageSearchActiveBackground); + isOnOrderedSongsPage = false; + + /* 清空搜尋欄 */ ResetinputBox(); string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_counts DESC LIMIT 1000"; @@ -101,7 +99,10 @@ namespace DualScreenDemo SetPictureBoxSceneSoundEffectsAndButtonsVisibility(false); SetPictureBoxLanguageButtonsVisibility(true); - + + UpdateLangBtns(guoYuButton, guoYuActiveBackground); + + if (pictureBoxQRCode != null) { pictureBoxQRCode.Visible = false; @@ -111,17 +112,9 @@ namespace DualScreenDemo private void OnLanguageButtonClick(Button activeButton, Image activeBackground, string category) { - - guoYuButton.BackgroundImage = guoYuNormalBackground; - taiYuButton.BackgroundImage = taiYuNormalBackground; - yueYuButton.BackgroundImage = yueYuNormalBackground; - yingWenButton.BackgroundImage = yingWenNormalBackground; - riYuButton.BackgroundImage = riYuNormalBackground; - hanYuButton.BackgroundImage = hanYuNormalBackground; - keYuButton.BackgroundImage = keYuNormalBackground; - - activeButton.BackgroundImage = activeBackground; + UpdateLangBtns(activeButton, activeBackground); + string query = $"SELECT * FROM song_library_cache WHERE language_name = '{category}' ORDER BY song_counts DESC LIMIT 1000"; var selectedSongs = SearchSongs_Mysql(query); @@ -133,22 +126,22 @@ namespace DualScreenDemo } private void SetPictureBoxLanguageButtonsVisibility(bool isVisible) - { + { guoYuButton.Visible = isVisible; guoYuButton.BringToFront(); - + taiYuButton.Visible = isVisible; taiYuButton.BringToFront(); - + yueYuButton.Visible = isVisible; yueYuButton.BringToFront(); - + yingWenButton.Visible = isVisible; yingWenButton.BringToFront(); - + riYuButton.Visible = isVisible; riYuButton.BringToFront(); - + hanYuButton.Visible = isVisible; hanYuButton.BringToFront(); @@ -156,15 +149,5 @@ namespace DualScreenDemo keYuButton.BringToFront(); } - private void InitializeButtonsForPictureBoxLanguageQuery() - { - InitializeGuoYuButton(); - InitializeTaiYuButton(); - InitializeYueYuButton(); - InitializeYingWenButton(); - InitializeRiYuButton(); - InitializeHanYuButton(); - InitializeKeYuButton(); - } } } \ No newline at end of file diff --git a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs index fb806e2..8c71718 100644 --- a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs +++ b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs @@ -27,29 +27,50 @@ namespace DualScreenDemo private Bitmap hanYuNewSongNormalBackground; private Bitmap hanYuNewSongActiveBackground; - private void ToggleNewSongButtonsVisibility() + private void UpdateNewSongBtns(Button activeButton, Image activeBackground) { - - bool areButtonsVisible = guoYuButtonNewSong.Visible; + guoYuButtonNewSong.BackgroundImage = guoYuNewSongNormalBackground; + taiYuButtonNewSong.BackgroundImage = taiYuNewSongNormalBackground; + yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground; + yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground; + riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground; + hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground; + + activeButton.BackgroundImage = activeBackground; + } + + private void InitializeButtonsForNewSong() + { + var data = LoadBtnConfigData(); + + InitializeButton(ref guoYuButtonNewSong, ref guoYuNewSongNormalBackground, ref guoYuNewSongActiveBackground, "guoYuButtonNewSong", 1197, 225, 225, 50, data["NewSongAlertBtn"]["GuoYuNewNormal"], data["NewSongAlertBtn"]["GuoYuNewActive"], GuoYuButtonNewSong_Click); + + + InitializeButton(ref taiYuButtonNewSong, ref taiYuNewSongNormalBackground, ref taiYuNewSongActiveBackground, "taiYuButtonNewSong", 1197, 280, 225, 50, data["NewSongAlertBtn"]["TaiYuNewNormal"], data["NewSongAlertBtn"]["TaiYuNewActive"], TaiYuButtonNewSong_Click); + + + InitializeButton(ref yueYuButtonNewSong, ref yueYuNewSongNormalBackground, ref yueYuNewSongActiveBackground, "yueYuButtonNewSong", 1197, 335, 225, 50, data["NewSongAlertBtn"]["YueYuNewNormal"], data["NewSongAlertBtn"]["YueYuNewActive"], YueYuButtonNewSong_Click); + + + InitializeButton(ref yingWenButtonNewSong, ref yingWenNewSongNormalBackground, ref yingWenNewSongActiveBackground, "yingWenButtonNewSong", 1197, 390, 225, 50, data["NewSongAlertBtn"]["EngNewNormal"], data["NewSongAlertBtn"]["EngNewActive"], YingWenButtonNewSong_Click); + + + InitializeButton(ref riYuButtonNewSong, ref riYuNewSongNormalBackground, ref riYuNewSongActiveBackground, "riYuButtonNewSong", 1197, 445, 225, 50, data["NewSongAlertBtn"]["JapNewNormal"], data["NewSongAlertBtn"]["JapNewActive"], RiYuButtonNewSong_Click); + + + InitializeButton(ref hanYuButtonNewSong, ref hanYuNewSongNormalBackground, ref hanYuNewSongActiveBackground, "hanYuButtonNewSong", 1197, 500, 225, 50, data["NewSongAlertBtn"]["KrNewNormal"], data["NewSongAlertBtn"]["KrNewActive"], HanYuButtonNewSong_Click); - - 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(); @@ -59,27 +80,10 @@ namespace DualScreenDemo private void NewSongAlertButton_Click(object sender, EventArgs e) { - - //newSongAlertButton.BackgroundImage = newSongAlertActiveBackground; - newSongAlertButton.BackgroundImage= new Bitmap(Path.Combine(serverPath, "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; + UpdateButtonBackgrounds(newSongAlertButton, newSongAlertActiveBackground); + isOnOrderedSongsPage = false; - guoYuButtonNewSong.BackgroundImage = guoYuNewSongActiveBackground; - taiYuButtonNewSong.BackgroundImage = taiYuNewSongNormalBackground; - yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground; - yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground; - riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground; - hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground; /* 清空搜尋欄 */ ResetinputBox(); @@ -105,9 +109,11 @@ namespace DualScreenDemo SetPinYinSongsAndButtonsVisibility(false); SetPictureBoxToggleLightAndButtonsVisibility(false); SetPictureBoxSceneSoundEffectsAndButtonsVisibility(false); - ToggleNewSongButtonsVisibility(); + SetNewSongButtonsVisibility(true); + + UpdateNewSongBtns(guoYuButtonNewSong, guoYuNewSongActiveBackground); + - if (pictureBoxQRCode != null) { pictureBoxQRCode.Visible = false; @@ -115,105 +121,6 @@ namespace DualScreenDemo } } - 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(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_國語(未按).png")); - guoYuNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "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(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_台語(未按).png")); - taiYuNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "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(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_粵語(未按).png")); - yueYuNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "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(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_英語(未按).png")); - yingWenNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "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(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_日語(未按).png")); - riYuNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "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(serverPath, "themes\\superstar\\button\\2.次類別\\1.新歌快報_韓語(未按).png")); - hanYuNewSongActiveBackground = new Bitmap(Path.Combine(serverPath, "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;"; diff --git a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertCantonese.cs b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertCantonese.cs index fdb89b1..841ab9e 100644 --- a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertCantonese.cs +++ b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertCantonese.cs @@ -4,13 +4,8 @@ namespace DualScreenDemo { private void YueYuButtonNewSong_Click(object sender, EventArgs e) { - guoYuButtonNewSong.BackgroundImage = guoYuNewSongNormalBackground; - taiYuButtonNewSong.BackgroundImage = taiYuNewSongNormalBackground; - yueYuButtonNewSong.BackgroundImage = yueYuNewSongActiveBackground; - yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground; - riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground; - hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground; + UpdateNewSongBtns(yueYuButtonNewSong, yueYuNewSongActiveBackground); var yueYuSongs2 = SearchSongs_Mysql(setQueryforNewSong("粵語")); currentPage = 0; totalPages = (int)Math.Ceiling((double)yueYuSongs2.Count / itemsPerPage); diff --git a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertChinese.cs b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertChinese.cs index 0a09c82..e45bad4 100644 --- a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertChinese.cs +++ b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertChinese.cs @@ -4,13 +4,8 @@ namespace DualScreenDemo { private void GuoYuButtonNewSong_Click(object sender, EventArgs e) { - guoYuButtonNewSong.BackgroundImage = guoYuNewSongActiveBackground; - taiYuButtonNewSong.BackgroundImage = taiYuNewSongNormalBackground; - yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground; - yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground; - riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground; - hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground; + UpdateNewSongBtns(guoYuButtonNewSong, guoYuNewSongActiveBackground); var guoYuSongs2 = SearchSongs_Mysql(setQueryforNewSong("國語")); currentPage = 0; totalPages = (int)Math.Ceiling((double)guoYuSongs2.Count / itemsPerPage); diff --git a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertEnglish.cs b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertEnglish.cs index 187e33b..60d23f8 100644 --- a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertEnglish.cs +++ b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertEnglish.cs @@ -4,13 +4,8 @@ namespace DualScreenDemo { private void YingWenButtonNewSong_Click(object sender, EventArgs e) { - guoYuButtonNewSong.BackgroundImage = guoYuNewSongNormalBackground; - taiYuButtonNewSong.BackgroundImage = taiYuNewSongNormalBackground; - yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground; - yingWenButtonNewSong.BackgroundImage = yingWenNewSongActiveBackground; - riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground; - hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground; + UpdateNewSongBtns(yingWenButtonNewSong, yingWenNewSongActiveBackground); var yingWenSongs2 = SearchSongs_Mysql(setQueryforNewSong("英語")); currentPage = 0; diff --git a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertJapanese.cs b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertJapanese.cs index edc7e5b..944d70c 100644 --- a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertJapanese.cs +++ b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertJapanese.cs @@ -4,13 +4,8 @@ namespace DualScreenDemo { private void RiYuButtonNewSong_Click(object sender, EventArgs e) { - guoYuButtonNewSong.BackgroundImage = guoYuNewSongNormalBackground; - taiYuButtonNewSong.BackgroundImage = taiYuNewSongNormalBackground; - yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground; - yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground; - riYuButtonNewSong.BackgroundImage = riYuNewSongActiveBackground; - hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground; + UpdateNewSongBtns(riYuButtonNewSong, riYuNewSongActiveBackground); var riYuSongs2 = SearchSongs_Mysql(setQueryforNewSong("日語")); currentPage = 0; totalPages = (int)Math.Ceiling((double)riYuSongs2.Count / itemsPerPage); diff --git a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertKorean.cs b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertKorean.cs index 5f7d3e7..a35e3d4 100644 --- a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertKorean.cs +++ b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertKorean.cs @@ -4,13 +4,8 @@ namespace DualScreenDemo { private void HanYuButtonNewSong_Click(object sender, EventArgs e) { - guoYuButtonNewSong.BackgroundImage = guoYuNewSongNormalBackground; - taiYuButtonNewSong.BackgroundImage = taiYuNewSongNormalBackground; - yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground; - yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground; - riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground; - hanYuButtonNewSong.BackgroundImage = hanYuNewSongActiveBackground; + UpdateNewSongBtns(hanYuButtonNewSong, hanYuNewSongActiveBackground); var hanYuSongs2 = SearchSongs_Mysql(setQueryforNewSong("韓語")); currentPage = 0; totalPages = (int)Math.Ceiling((double)hanYuSongs2.Count / itemsPerPage); diff --git a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertTaiwanese.cs b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertTaiwanese.cs index b9259c1..08fadff 100644 --- a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertTaiwanese.cs +++ b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlertTaiwanese.cs @@ -4,13 +4,8 @@ namespace DualScreenDemo { private void TaiYuButtonNewSong_Click(object sender, EventArgs e) { - guoYuButtonNewSong.BackgroundImage = guoYuNewSongNormalBackground; - taiYuButtonNewSong.BackgroundImage = taiYuNewSongActiveBackground; - yueYuButtonNewSong.BackgroundImage = yueYuNewSongNormalBackground; - yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground; - riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground; - hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground; + UpdateNewSongBtns(taiYuButtonNewSong, taiYuNewSongActiveBackground); var taiYuSongs2 = SearchSongs_Mysql(setQueryforNewSong("台語")); currentPage = 0; totalPages = (int)Math.Ceiling((double)taiYuSongs2.Count / itemsPerPage); diff --git a/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs b/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs index e0bdfbf..6a89e28 100644 --- a/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs +++ b/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs @@ -449,16 +449,18 @@ namespace DualScreenDemo int artistWidth = (int)(this.Width * ArtistWidth); int artistX = songX + songWidth + 10; - var data = LoadConfigData(); + var data = PrimaryForm.Instance.LoadBtnConfigData(); // 添加人聲標籤 if (song.getHumanVoice() == 1) { + + PictureBox icon = new PictureBox() { - Image = Image.FromFile(Path.Combine(serverPath, @"themes\superstar\button\3.介面\其他符號_人聲.png")), + Image = Image.FromFile(Path.Combine(serverPath,data["PrimaryFormBtn"]["Voice"])), SizeMode = PictureBoxSizeMode.Zoom, - Size = new Size(30, 30), + Size = new Size(26, 26), Location = new Point(songX + 5, y + 8) }; this.Controls.Add(icon); diff --git a/PrimaryFormParts/PrimaryForm.VodScreen.cs b/PrimaryFormParts/PrimaryForm.VodScreen.cs index 89f28ec..af0502f 100644 --- a/PrimaryFormParts/PrimaryForm.VodScreen.cs +++ b/PrimaryFormParts/PrimaryForm.VodScreen.cs @@ -11,7 +11,7 @@ namespace DualScreenDemo private Button favoriteButton; private Panel disabledPanel; private Button vodScreenCloseButton; - + private void InitializeButtonsForVodScreenPictureBox() { int screenWidth = 1920; @@ -22,35 +22,19 @@ namespace DualScreenDemo int xPosition = (screenWidth - pictureBoxWidth) / 2; int yPosition = (screenHeight - pictureBoxHeight) / 2; - var data=LoadConfigData(); - - if (isOnOrderedSongsPage) - { - vodButton = new Button(); - vodButton.Text = ""; - ConfigureButton(vodButton, xPosition - 119, yPosition + 35, 110, 50, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\3.介面\\歌曲點播-08.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\3.介面\\歌曲點播-08.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\3.介面\\歌曲點播-08.png")), - VodButton_Click); - - vodButton.Visible = false; - } - else - { - vodButton = new Button(); - vodButton.Text = ""; - ConfigureButton(vodButton, xPosition - 119, yPosition + 35, 110, 50, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\3.介面\\歌曲點播_點播.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\3.介面\\歌曲點播_點播.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\3.介面\\歌曲點播_點播.png")), - VodButton_Click); - - vodButton.Visible = false; - } + var data = LoadBtnConfigData(); - + vodButton = new Button(); + vodButton.Text = ""; + ConfigureButton(vodButton, xPosition - 119, yPosition + 35, 110, 50, + new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\3.介面\\歌曲點播_點播.png")), + new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\3.介面\\歌曲點播_點播.png")), + new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\3.介面\\歌曲點播_點播.png")), + VodButton_Click); + + vodButton.Visible = false; + insertButton = new Button(); insertButton.Text = ""; ConfigureButton(insertButton, xPosition + 12, yPosition + 35, 110, 50, @@ -61,7 +45,7 @@ namespace DualScreenDemo insertButton.Visible = false; - + albumButton = new Button(); albumButton.Text = ""; ConfigureButton(albumButton, xPosition + 142, yPosition + 35, 140, 50, @@ -72,7 +56,7 @@ namespace DualScreenDemo albumButton.Visible = false; - + favoriteButton = new Button(); favoriteButton.Text = ""; ConfigureButton(favoriteButton, xPosition + 302, yPosition + 35, 140, 50, @@ -81,24 +65,25 @@ namespace DualScreenDemo new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\3.介面\\歌曲點播_我的最愛.png")), FavoriteButton_Click); - - disabledPanel = new Panel(); - disabledPanel.BackColor = Color.FromArgb(128, Color.Black); - disabledPanel.Dock = DockStyle.Fill; - - disabledPanel.Visible = !isLoggedIn; - + disabledPanel = new Panel(); + disabledPanel.BackColor = Color.FromArgb(128, Color.Black); + disabledPanel.Dock = DockStyle.Fill; + + disabledPanel.Visible = !isLoggedIn; + + favoriteButton.Controls.Add(disabledPanel); - - - if (!isLoggedIn) { + + + if (!isLoggedIn) + { favoriteButton.Enabled = false; - favoriteButton.BackColor = SystemColors.Control; + favoriteButton.BackColor = SystemColors.Control; } favoriteButton.Visible = isLoggedIn; - + vodScreenCloseButton = new Button(); vodScreenCloseButton.Text = ""; ConfigureButton(vodScreenCloseButton, xPosition + 462, yPosition + 35, 110, 50, @@ -107,7 +92,7 @@ namespace DualScreenDemo new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\3.介面\\歌曲點播_關閉.png")), VodScreenCloseButton_Click); - + this.Controls.Add(vodButton); this.Controls.Add(insertButton); this.Controls.Add(albumButton); @@ -116,7 +101,7 @@ namespace DualScreenDemo } private void VodButton_Click(object sender, EventArgs e) { - if (isOnOrderedSongsPage) + if (isOnOrderedSongsPage) { SetVodScreenPictureBoxAndButtonsVisibility(false); SongList.Cancel(currentSelectedSong); @@ -160,7 +145,7 @@ namespace DualScreenDemo // 更新多頁面面板的內容 multiPagePanel.currentPageIndex = 0; multiPagePanel.LoadSongs(searchResults); - + SetVodScreenPictureBoxAndButtonsVisibility(false); } @@ -169,7 +154,7 @@ namespace DualScreenDemo SetVodScreenPictureBoxAndButtonsVisibility(false); } - + private void SetVodScreenPictureBoxAndButtonsVisibility(bool isVisible) { @@ -180,13 +165,17 @@ namespace DualScreenDemo albumButton.Visible = isVisible; favoriteButton.Visible = isVisible; vodScreenCloseButton.Visible = isVisible; - if (isVisible){ - if (isLoggedIn){ + if (isVisible) + { + if (isLoggedIn) + { favoriteButton.Enabled = true; - favoriteButton.Controls.Remove(disabledPanel); - } else { + favoriteButton.Controls.Remove(disabledPanel); + } + else + { favoriteButton.Enabled = false; - + } overlayPanel.BringToFront(); VodScreenPictureBox.BringToFront(); diff --git a/PrimaryFormParts/PrimaryForm.cs b/PrimaryFormParts/PrimaryForm.cs index ea8e945..a70bf2d 100644 --- a/PrimaryFormParts/PrimaryForm.cs +++ b/PrimaryFormParts/PrimaryForm.cs @@ -77,50 +77,50 @@ namespace DualScreenDemo private Button btnSimplifiedChinese; private Button btnTraditionalChinese; private Button exitButton; - private static Bitmap normalStateImage; - private static Bitmap mouseOverImage; - private static Bitmap mouseDownImage; - private static Bitmap resizedNormalStateImage; - private static Bitmap resizedMouseOverImage; - private static Bitmap resizedMouseDownImage; - private static Bitmap normalStateImageNewSongAlert; - private static Bitmap mouseOverImageNewSongAlert; - private static Bitmap mouseDownImageNewSongAlert; - private static Bitmap resizedNormalStateImageForNewSongAlert; - private static Bitmap resizedMouseOverImageForNewSongAlert; - private static Bitmap resizedMouseDownImageForNewSongAlert; - private static Bitmap normalStateImageArtistQuery; - private static Bitmap mouseOverImageArtistQuery; - private static Bitmap mouseDownImageArtistQuery; - private static Bitmap resizedNormalStateImageForArtistQuery; - private static Bitmap resizedMouseOverImageForArtistQuery; - private static Bitmap resizedMouseDownImageForArtistQuery; - private static Bitmap normalStateImageSongQuery; - private static Bitmap mouseOverImageSongQuery; - private static Bitmap mouseDownImageSongQuery; - private static Bitmap resizedNormalStateImageForSongQuery; - private static Bitmap resizedMouseOverImageForSongQuery; - private static Bitmap resizedMouseDownImageForSongQuery; - private static Bitmap normalStateImageLanguageQuery; - private static Bitmap mouseOverImageLanguageQuery; - private static Bitmap mouseDownImageLanguageQuery; - private static Bitmap resizedNormalStateImageForLanguageQuery; - private static Bitmap resizedMouseOverImageForLanguageQuery; - private static Bitmap resizedMouseDownImageForLanguageQuery; - private static Bitmap normalStateImageCategoryQuery; - private static Bitmap mouseOverImageCategoryQuery; - private static Bitmap mouseDownImageCategoryQuery; - private static Bitmap resizedNormalStateImageForCategoryQuery; - private static Bitmap resizedMouseOverImageForCategoryQuery; - private static Bitmap resizedMouseDownImageForCategoryQuery; - private static Bitmap normalStateImageForPromotionsAndMenu; - private static Bitmap resizedNormalStateImageForPromotionsAndMenu; - private static Bitmap normalStateImageForSyncScreen; - private static Bitmap resizedNormalStateImageForSyncScreen; - private static Bitmap normalStateImageForSceneSoundEffects; - private static Bitmap resizedNormalStateImageForSceneSoundEffects; - private static Bitmap normalStateImageForLightControl; - private static Bitmap resizedNormalStateImageForLightControl; + //private static Bitmap normalStateImage; + //private static Bitmap mouseOverImage; + //private static Bitmap mouseDownImage; + //private static Bitmap resizedNormalStateImage; + //private static Bitmap resizedMouseOverImage; + //private static Bitmap resizedMouseDownImage; + //private static Bitmap normalStateImageNewSongAlert; + //private static Bitmap mouseOverImageNewSongAlert; + //private static Bitmap mouseDownImageNewSongAlert; + //private static Bitmap resizedNormalStateImageForNewSongAlert; + //private static Bitmap resizedMouseOverImageForNewSongAlert; + //private static Bitmap resizedMouseDownImageForNewSongAlert; + //private static Bitmap normalStateImageArtistQuery; + //private static Bitmap mouseOverImageArtistQuery; + //private static Bitmap mouseDownImageArtistQuery; + //private static Bitmap resizedNormalStateImageForArtistQuery; + //private static Bitmap resizedMouseOverImageForArtistQuery; + //private static Bitmap resizedMouseDownImageForArtistQuery; + //private static Bitmap normalStateImageSongQuery; + //private static Bitmap mouseOverImageSongQuery; + //private static Bitmap mouseDownImageSongQuery; + //private static Bitmap resizedNormalStateImageForSongQuery; + //private static Bitmap resizedMouseOverImageForSongQuery; + //private static Bitmap resizedMouseDownImageForSongQuery; + //private static Bitmap normalStateImageLanguageQuery; + //private static Bitmap mouseOverImageLanguageQuery; + //private static Bitmap mouseDownImageLanguageQuery; + //private static Bitmap resizedNormalStateImageForLanguageQuery; + //private static Bitmap resizedMouseOverImageForLanguageQuery; + //private static Bitmap resizedMouseDownImageForLanguageQuery; + //private static Bitmap normalStateImageCategoryQuery; + //private static Bitmap mouseOverImageCategoryQuery; + //private static Bitmap mouseDownImageCategoryQuery; + //private static Bitmap resizedNormalStateImageForCategoryQuery; + //private static Bitmap resizedMouseOverImageForCategoryQuery; + //private static Bitmap resizedMouseDownImageForCategoryQuery; + //private static Bitmap normalStateImageForPromotionsAndMenu; + //private static Bitmap resizedNormalStateImageForPromotionsAndMenu; + //private static Bitmap normalStateImageForSyncScreen; + //private static Bitmap resizedNormalStateImageForSyncScreen; + //private static Bitmap normalStateImageForSceneSoundEffects; + //private static Bitmap resizedNormalStateImageForSceneSoundEffects; + //private static Bitmap normalStateImageForLightControl; + //private static Bitmap resizedNormalStateImageForLightControl; public VideoPlayerForm videoPlayerForm; public List currentArtistList; public MultiPagePanel multiPagePanel; @@ -168,10 +168,10 @@ namespace DualScreenDemo private Panel sendOffPanel; - private static Bitmap normalStateImageHotSong; - private static Bitmap mouseDownImageHotSong; - private static Bitmap resizedNormalStateImageForHotSong; - private static Bitmap resizedMouseDownImageForHotSong; + //private static Bitmap normalStateImageHotSong; + //private static Bitmap mouseDownImageHotSong; + //private static Bitmap resizedNormalStateImageForHotSong; + //private static Bitmap resizedMouseDownImageForHotSong; private PictureBox serviceBellPictureBox; // 添加为类成员变量 private Timer autoRefreshTimer; @@ -208,7 +208,7 @@ namespace DualScreenDemo InitializeRecording(); InitializeMediaPlayer(); - LoadImages(); + //LoadImages(); InitializeFormAndControls(); InitializeMultiPagePanel(); OverlayQRCodeOnImage(HttpServer.randomFolderPath); @@ -497,9 +497,9 @@ namespace DualScreenDemo string selectedTheme = ReadSelectedThemePath(); if (!string.IsNullOrEmpty(selectedTheme)) { - var data = LoadConfigData(); + var data = LoadBtnConfigData(); - string backgroundImagePath = Path.Combine(serverPath, "themes\\superstar\\主畫面\\0.下方選單_主畫面.jpg"); + string backgroundImagePath = Path.Combine(serverPath, data["PrimaryFormBtn"]["MainFrameWSubBtn"]); try { using (Image originalImage = Image.FromFile(backgroundImagePath)) @@ -520,7 +520,7 @@ namespace DualScreenDemo InitializeButtonsForNewSong(); InitializeButtonsForSingerSearch(); InitializeButtonsForSongSearch(); - InitializeButtonsForPictureBoxLanguageQuery(); + InitializeLangSearchButtons(); InitializeButtonsForGroupPictureBox(); InitializeCategorySearchButtons(); InitializeButtonsForZhuYinSingers(); @@ -535,7 +535,7 @@ namespace DualScreenDemo InitializeButtonsForFavoritePictureBox(); InitializePromotionsButton(); InitializeButtonsForPictureBoxToggleLight(); - //InitializeButtonsForVodScreenPictureBox(); + InitializeButtonsForVodScreenPictureBox(); InitializeSoundEffectButtons(); InitializeSyncScreen(); @@ -1050,9 +1050,9 @@ namespace DualScreenDemo serviceBellButton = new Button { Text = "" }; ConfigureButton(serviceBellButton, 843, 98, 107, 120, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(未按).png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(已按).png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(已按).png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormBtn"]["BellNormal"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormBtn"]["BellActive"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormBtn"]["BellActive"])), (sender, e) => OnServiceBellButtonClick(sender, e)); @@ -1068,72 +1068,72 @@ namespace DualScreenDemo mobileSongRequestButton = new Button { Text = "" }; mobileSongRequestButton.Name = "mobileSongRequestButton"; ConfigureButton(mobileSongRequestButton, 1198, 629, 223, 88, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MobileOrder"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MobileOrder"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MobileOrder"])), MobileSongRequestButton_Click); qieGeButton = new Button { Text = "" }; qieGeButton.Name = "qieGeButton"; ConfigureButton(qieGeButton, 20, 738, 92, 147, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["QieGe"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["QieGe"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["QieGe"])), (sender, e) => videoPlayerForm.PlayNextSong()); musicUpButton = new Button { Text = "" }; musicUpButton.Name = "musicUpButton"; ConfigureButton(musicUpButton, 128, 738, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂+.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂+.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_音樂++.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MusicGainNormal"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MusicGainNormal"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MusicGainActive"])), (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↑", "a2 b3 a4"); }); musicDownButton = new Button { Text = "" }; musicDownButton.Name = "musicDownButton"; ConfigureButton(musicDownButton, 128, 823, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂-.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂-.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_音樂--.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MusicLowNormal"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MusicLowNormal"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MusicLowActive"])), (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↓", "a2 b4 a4"); }); micUpButton = new Button { Text = "" }; micUpButton.Name = "micUpButton"; ConfigureButton(micUpButton, 238, 738, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風+.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風+.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_麥克風++.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MiPhoneGainNormal"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MiPhoneGainNormal"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MiPhoneGainActive"])), (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↑", "a2 b5 a4"); }); micDownButton = new Button { Text = "" }; micDownButton.Name = "micDownButton"; ConfigureButton(micDownButton, 238, 823, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風-.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風-.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_麥克風--.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MiPhoneLowNormal"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MiPhoneLowNormal"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MiPhoneLowActive"])), (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↓", "a2 b6 a4"); }); originalSongButton = new Button { Text = "" }; originalSongButton.Name = "originalSongButton"; ConfigureButton(originalSongButton, 347, 738, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["OriginalSound"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["OriginalSound"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["OriginalSound"])), OriginalSongButton_Click); replayButton = new Button { Text = "" }; replayButton.Name = "replayButton"; ConfigureButton(replayButton, 347, 823, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Replay"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Replay"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Replay"])), ReplayButton_Click); @@ -1143,9 +1143,9 @@ namespace DualScreenDemo Name = "pauseButton" }; ConfigureButton(pauseButton, 456, 738, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Pause"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Pause"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Pause"])), PauseButton_Click); @@ -1156,144 +1156,144 @@ namespace DualScreenDemo Visible = false }; ConfigureButton(playButton, 456, 738, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Play"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Play"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Play"])), PlayButton_Click); muteButton = new Button { Text = "" }; muteButton.Name = "muteButton"; ConfigureButton(muteButton, 456, 823, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Mute"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Mute"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Mute"])), MuteUnmuteButton_Click); maleKeyButton = new Button { Text = "" }; maleKeyButton.Name = "maleKeyButton"; ConfigureButton(maleKeyButton, 564, 738, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MaleTone"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MaleTone"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["MaleTone"])), MaleKeyButton_Click); femaleKeyButton = new Button { Text = "" }; femaleKeyButton.Name = "femaleKeyButton"; ConfigureButton(femaleKeyButton, 565, 823, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["FemaleTone"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["FemaleTone"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["FemaleTone"])), FemaleKeyButton_Click); standardKeyButton = new Button { Text = "" }; standardKeyButton.Name = "standardKeyButton"; ConfigureButton(standardKeyButton, 674, 738, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["StandardTone"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["StandardTone"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["StandardTone"])), StandardKeyButton_Click); soundEffectButton = new Button { Text = "" }; soundEffectButton.Name = "soundEffectButton"; ConfigureButton(soundEffectButton, 674, 823, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["SoundEffect"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["SoundEffect"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["SoundEffect"])), SoundEffectButton_Click); pitchUpButton = new Button { Text = "" }; pitchUpButton.Name = "pitchUpButton"; ConfigureButton(pitchUpButton, 784, 738, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["HigherTone"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["HigherTone"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["HigherTone"])), PitchUpButton_Click); pitchDownButton = new Button { Text = "" }; pitchDownButton.Name = "pitchDownButton"; ConfigureButton(pitchDownButton, 784, 823, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["LowerTone"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["LowerTone"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["LowerTone"])), PitchDownButton_Click); syncScreenButton = new Button { Text = "" }; syncScreenButton.Name = "syncScreenButton"; ConfigureButton(syncScreenButton, 893, 736, 92, 149, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["ScreenSync"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["ScreenSync"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["ScreenSync"])), SyncScreenButton_Click); toggleLightButton = new Button { Text = "" }; toggleLightButton.Name = "toggleLightButton"; ConfigureButton(toggleLightButton, 1002, 736, 92, 149, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["LightControl"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["LightControl"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["LightControl"])), ToggleLightButton_Click); btnPreviousPage = new Button { Text = "" }; btnPreviousPage.Name = "btnPreviousPageButton"; ConfigureButton(btnPreviousPage, 1110, 738, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["PrePage"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["PrePage"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["PrePage"])), PreviousPageButton_Click); btnReturn = new Button { Text = "" }; btnReturn.Name = "btnReturn"; ConfigureButton(btnReturn, 1220, 738, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Exit"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Exit"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Exit"])), ShouYeButton_Click); btnNextPage = new Button { Text = "" }; btnNextPage.Name = "btnNextPage"; ConfigureButton(btnNextPage, 1330, 738, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["NextPage"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["NextPage"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["NextPage"])), NextPageButton_Click); btnApplause = new Button { Text = "" }; btnApplause.Name = "btnApplause"; ConfigureButton(btnApplause, 1110, 823, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Appaulse"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Appaulse"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Appaulse"])), ApplauseButton_Click); btnSimplifiedChinese = new Button { Text = "" }; btnSimplifiedChinese.Name = "btnSimplifiedChinese"; ConfigureButton(btnSimplifiedChinese, 1330, 823, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Simplified"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Simplified"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Simplified"])), SimplifiedChineseButton_Click); btnTraditionalChinese = new Button { Text = "" }; btnTraditionalChinese.Name = "btnTraditionalChinese"; ConfigureButton(btnTraditionalChinese, 1220, 823, 93, 62, - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")), - new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Traditional"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Traditional"])), + new Bitmap(Path.Combine(serverPath, data["PrimaryFormSubBtn"]["Traditional"])), TraditionalChineseButton_Click); /* 關閉應用程式按鈕*/ @@ -1356,9 +1356,8 @@ namespace DualScreenDemo public void Label_Click(object sender, EventArgs e) { - InitializeButtonsForVodScreenPictureBox(); - var data = LoadConfigData(); + var data = LoadBtnConfigData(); var label = sender as Label; if (label != null && label.Tag is SongData) { @@ -1367,10 +1366,19 @@ namespace DualScreenDemo this.DoubleBuffered = true; this.SuspendLayout(); - DrawTextOnVodScreenPictureBox(Path.Combine(serverPath, @"themes\superstar\button\3.介面\歌曲點播_空白介面.png"), currentSelectedSong); + DrawTextOnVodScreenPictureBox(Path.Combine(serverPath, data["SongOrderPanel"]["UIBase"]), currentSelectedSong); SetVodScreenPictureBoxAndButtonsVisibility(true); this.ResumeLayout(true); } + + if (isOnOrderedSongsPage) + { + vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"])); + vodButton.MouseEnter += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"])); ; + vodButton.MouseLeave += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"])); ; + vodButton.MouseDown += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"])); ; + vodButton.MouseUp += (sender, e) => vodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, data["SongOrderPanel"]["DelBtn"])); ; + } } public static void WriteLog(string message) @@ -1442,123 +1450,125 @@ namespace DualScreenDemo return destImage; } - private void LoadImages() - { - var data = LoadConfigData(); + #region LoadImages + //private void LoadImages() + //{ + // var data = LoadBtnConfigData(); - string selectedThemePath = ReadSelectedThemePath(); + // string selectedThemePath = ReadSelectedThemePath(); - string basePath = Path.Combine(serverPath, selectedThemePath); - int targetWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; - int targetHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; + // string basePath = Path.Combine(serverPath, selectedThemePath); + // int targetWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; + // int targetHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; - normalStateImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\0.下方選單_主畫面.jpg")); + // normalStateImage = new Bitmap(Path.Combine(serverPath, data["PrimaryFormBtn"]["MainFrameWSubBtn"])); - resizedNormalStateImage = ResizeImage(normalStateImage, targetWidth, targetHeight); + // resizedNormalStateImage = ResizeImage(normalStateImage, targetWidth, targetHeight); - mouseOverImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\0.主選單_已按.jpg")); + // mouseOverImage = new Bitmap(Path.Combine(serverPath, data["PrimaryFormBtn"]["MainFrameBtnPressed"])); - resizedMouseOverImage = ResizeImage(mouseOverImage, targetWidth, targetHeight); + // resizedMouseOverImage = ResizeImage(mouseOverImage, targetWidth, targetHeight); - mouseDownImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\0.主選單_已按.jpg")); + // mouseDownImage = new Bitmap(Path.Combine(serverPath, data["PrimaryFormBtn"]["MainFrameBtnPressed"])); - resizedMouseDownImage = ResizeImage(mouseDownImage, targetWidth, targetHeight); + // resizedMouseDownImage = ResizeImage(mouseDownImage, targetWidth, targetHeight); - normalStateImageNewSongAlert = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\1.新歌快報_未按.jpg")); + // normalStateImageNewSongAlert = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\1.新歌快報_未按.jpg")); - resizedNormalStateImageForNewSongAlert = ResizeImage(normalStateImageNewSongAlert, targetWidth, targetHeight); + // resizedNormalStateImageForNewSongAlert = ResizeImage(normalStateImageNewSongAlert, targetWidth, targetHeight); - mouseOverImageNewSongAlert = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\1.新歌快報_已按.jpg")); + // mouseOverImageNewSongAlert = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\1.新歌快報_已按.jpg")); - resizedMouseOverImageForNewSongAlert = ResizeImage(mouseOverImageNewSongAlert, targetWidth, targetHeight); + // resizedMouseOverImageForNewSongAlert = ResizeImage(mouseOverImageNewSongAlert, targetWidth, targetHeight); - mouseDownImageNewSongAlert = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\1.新歌快報_已按.jpg")); + // mouseDownImageNewSongAlert = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\1.新歌快報_已按.jpg")); - resizedMouseDownImageForNewSongAlert = ResizeImage(mouseDownImageNewSongAlert, targetWidth, targetHeight); + // resizedMouseDownImageForNewSongAlert = ResizeImage(mouseDownImageNewSongAlert, targetWidth, targetHeight); - normalStateImageArtistQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\3.歌星查詢_未按.jpg")); + // normalStateImageArtistQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\3.歌星查詢_未按.jpg")); - resizedNormalStateImageForArtistQuery = ResizeImage(normalStateImageArtistQuery, targetWidth, targetHeight); + // resizedNormalStateImageForArtistQuery = ResizeImage(normalStateImageArtistQuery, targetWidth, targetHeight); - mouseOverImageArtistQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\3.歌星查詢_已按.jpg")); + // mouseOverImageArtistQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\3.歌星查詢_已按.jpg")); - resizedMouseOverImageForArtistQuery = ResizeImage(mouseOverImageArtistQuery, targetWidth, targetHeight); + // resizedMouseOverImageForArtistQuery = ResizeImage(mouseOverImageArtistQuery, targetWidth, targetHeight); - mouseDownImageArtistQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\3.歌星查詢_已按.jpg")); + // mouseDownImageArtistQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\3.歌星查詢_已按.jpg")); - resizedMouseDownImageForArtistQuery = ResizeImage(mouseDownImageArtistQuery, targetWidth, targetHeight); + // resizedMouseDownImageForArtistQuery = ResizeImage(mouseDownImageArtistQuery, targetWidth, targetHeight); - normalStateImageSongQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\4.歌名查詢_未按.jpg")); + // normalStateImageSongQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\4.歌名查詢_未按.jpg")); - resizedNormalStateImageForSongQuery = ResizeImage(normalStateImageSongQuery, targetWidth, targetHeight); + // resizedNormalStateImageForSongQuery = ResizeImage(normalStateImageSongQuery, targetWidth, targetHeight); - mouseOverImageSongQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\4.歌名查詢_已按.jpg")); + // mouseOverImageSongQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\4.歌名查詢_已按.jpg")); - resizedMouseOverImageForSongQuery = ResizeImage(mouseOverImageSongQuery, targetWidth, targetHeight); + // resizedMouseOverImageForSongQuery = ResizeImage(mouseOverImageSongQuery, targetWidth, targetHeight); - mouseDownImageSongQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\4.歌名查詢_已按.jpg")); + // mouseDownImageSongQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\4.歌名查詢_已按.jpg")); - resizedMouseDownImageForSongQuery = ResizeImage(mouseDownImageSongQuery, targetWidth, targetHeight); + // resizedMouseDownImageForSongQuery = ResizeImage(mouseDownImageSongQuery, targetWidth, targetHeight); - normalStateImageLanguageQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\5.語別查詢_未按.jpg")); - resizedNormalStateImageForLanguageQuery = ResizeImage(normalStateImageLanguageQuery, targetWidth, targetHeight); + // normalStateImageLanguageQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\5.語別查詢_未按.jpg")); + // resizedNormalStateImageForLanguageQuery = ResizeImage(normalStateImageLanguageQuery, targetWidth, targetHeight); - mouseOverImageLanguageQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\5.語別查詢_已按.jpg")); - resizedMouseOverImageForLanguageQuery = ResizeImage(mouseOverImageLanguageQuery, targetWidth, targetHeight); + // mouseOverImageLanguageQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\5.語別查詢_已按.jpg")); + // resizedMouseOverImageForLanguageQuery = ResizeImage(mouseOverImageLanguageQuery, targetWidth, targetHeight); - mouseDownImageLanguageQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\5.語別查詢_已按.jpg")); - resizedMouseDownImageForLanguageQuery = ResizeImage(mouseDownImageLanguageQuery, targetWidth, targetHeight); + // mouseDownImageLanguageQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\5.語別查詢_已按.jpg")); + // resizedMouseDownImageForLanguageQuery = ResizeImage(mouseDownImageLanguageQuery, targetWidth, targetHeight); - normalStateImageCategoryQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\7.類別查詢_未按.jpg")); - resizedNormalStateImageForCategoryQuery = ResizeImage(normalStateImageCategoryQuery, targetWidth, targetHeight); + // normalStateImageCategoryQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\7.類別查詢_未按.jpg")); + // resizedNormalStateImageForCategoryQuery = ResizeImage(normalStateImageCategoryQuery, targetWidth, targetHeight); - mouseOverImageCategoryQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\7.類別查詢_已按.jpg")); - resizedMouseOverImageForCategoryQuery = ResizeImage(mouseOverImageCategoryQuery, targetWidth, targetHeight); + // mouseOverImageCategoryQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\7.類別查詢_已按.jpg")); + // resizedMouseOverImageForCategoryQuery = ResizeImage(mouseOverImageCategoryQuery, targetWidth, targetHeight); - mouseDownImageCategoryQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\7.類別查詢_已按.jpg")); - resizedMouseDownImageForCategoryQuery = ResizeImage(mouseDownImageCategoryQuery, targetWidth, targetHeight); + // mouseDownImageCategoryQuery = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\7.類別查詢_已按.jpg")); + // resizedMouseDownImageForCategoryQuery = ResizeImage(mouseDownImageCategoryQuery, targetWidth, targetHeight); - normalStateImageForPromotionsAndMenu = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\555021.jpg")); - resizedNormalStateImageForPromotionsAndMenu = ResizeImage(normalStateImageForPromotionsAndMenu, targetWidth, targetHeight); + // normalStateImageForPromotionsAndMenu = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\555021.jpg")); + // resizedNormalStateImageForPromotionsAndMenu = ResizeImage(normalStateImageForPromotionsAndMenu, targetWidth, targetHeight); - try - { - string imagePath = Path.Combine(serverPath, "themes\\superstar\\主畫面\\選單內介面_同步畫面.jpg"); + // try + // { + // string imagePath = Path.Combine(serverPath, "themes\\superstar\\主畫面\\選單內介面_同步畫面.jpg"); - if (File.Exists(imagePath)) - { - normalStateImageForSyncScreen = new Bitmap(imagePath); - resizedNormalStateImageForSyncScreen = ResizeImage(normalStateImageForSyncScreen, targetWidth, targetHeight); - Console.WriteLine("Image loaded successfully."); - } - else - { - Console.WriteLine("Image file does not exist: " + imagePath); + // if (File.Exists(imagePath)) + // { + // normalStateImageForSyncScreen = new Bitmap(imagePath); + // resizedNormalStateImageForSyncScreen = ResizeImage(normalStateImageForSyncScreen, targetWidth, targetHeight); + // Console.WriteLine("Image loaded successfully."); + // } + // else + // { + // Console.WriteLine("Image file does not exist: " + imagePath); - } - } - catch (Exception ex) - { - Console.WriteLine("Failed to load image: " + ex.Message); + // } + // } + // catch (Exception ex) + // { + // Console.WriteLine("Failed to load image: " + ex.Message); - } + // } - normalStateImageForSceneSoundEffects = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\555022.jpg")); - resizedNormalStateImageForSceneSoundEffects = ResizeImage(normalStateImageForSceneSoundEffects, targetWidth, targetHeight); + // normalStateImageForSceneSoundEffects = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\555022.jpg")); + // resizedNormalStateImageForSceneSoundEffects = ResizeImage(normalStateImageForSceneSoundEffects, targetWidth, targetHeight); - normalStateImageHotSong = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\2.熱門排行_未按.jpg")); - resizedNormalStateImageForHotSong = ResizeImage(normalStateImageHotSong, targetWidth, targetHeight); + // normalStateImageHotSong = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\2.熱門排行_未按.jpg")); + // resizedNormalStateImageForHotSong = ResizeImage(normalStateImageHotSong, targetWidth, targetHeight); - mouseDownImageHotSong = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\2.熱門排行_已按.jpg")); - resizedMouseDownImageForHotSong = ResizeImage(mouseDownImageHotSong, targetWidth, targetHeight); + // mouseDownImageHotSong = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\2.熱門排行_已按.jpg")); + // resizedMouseDownImageForHotSong = ResizeImage(mouseDownImageHotSong, targetWidth, targetHeight); - normalStateImageForLightControl = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\選單內介面_燈光控制.jpg")); - resizedNormalStateImageForLightControl = ResizeImage(normalStateImageForLightControl, targetWidth, targetHeight); - } + // normalStateImageForLightControl = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\主畫面\\選單內介面_燈光控制.jpg")); + // resizedNormalStateImageForLightControl = ResizeImage(normalStateImageForLightControl, targetWidth, targetHeight); + //} + #endregion private Bitmap CropImage(Bitmap source, Rectangle section) { @@ -1689,10 +1699,10 @@ namespace DualScreenDemo private void DeliciousFoodButton_Click(object sender, EventArgs e) { - var data = LoadConfigData(); + var data = LoadBtnConfigData(); + + UpdateButtonBackgrounds(deliciousFoodButton, new Bitmap(Path.Combine(serverPath, data["PrimaryFormBtn"]["FoodActive"]))); - ResetPrimaryBtnStatus(); - deliciousFoodButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_美味菜單(已按).png")); isOnOrderedSongsPage = false; SetHotSongButtonsVisibility(false); @@ -1885,12 +1895,6 @@ namespace DualScreenDemo private void MuteUnmuteButton_Click(object sender, EventArgs e) { - //SetHotSongButtonsVisibility(false); - //SetNewSongButtonsVisibility(false); - //SetSingerSearchButtonsVisibility(false); - //SetSongSearchButtonsVisibility(false); - //SetPictureBoxToggleLightAndButtonsVisibility(false); - if (videoPlayerForm.isMuted) { @@ -2194,11 +2198,11 @@ namespace DualScreenDemo /// private Image LoadSendOffImage() { - var data = LoadConfigData(); + var data = LoadBtnConfigData(); try { - string filePath = Path.Combine(serverPath, "themes\\superstar\\主畫面\\選單內介面_送客畫面.jpg"); + string filePath = Path.Combine(serverPath, data["PrimaryFormBtn"]["Close"]); if (File.Exists(filePath)) { return Image.FromFile(filePath); @@ -2241,11 +2245,9 @@ namespace DualScreenDemo private void OrderedSongsButton_Click(object sender, EventArgs e) { - var data = LoadConfigData(); - - ResetPrimaryBtnStatus(); - orderedSongsButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_已點歌曲(已按).png")); + var data = LoadBtnConfigData(); + UpdateButtonBackgrounds(orderedSongsButton,orderedSongsActiveBackground); isOnOrderedSongsPage = true; autoRefreshTimer.Start(); // 开始自动刷新 @@ -2340,10 +2342,9 @@ namespace DualScreenDemo } } - //主畫面按鍵圖形重置 - private void ResetPrimaryBtnStatus() + //主畫面上排按鍵圖形狀態設置 + private void UpdateButtonBackgrounds(Button activeButton, Image activeBackground) { - newSongAlertButton.BackgroundImage = newSongAlertNormalBackground; hotPlayButton.BackgroundImage = hotPlayNormalBackground; singerSearchButton.BackgroundImage = singerSearchNormalBackground; @@ -2355,6 +2356,8 @@ namespace DualScreenDemo myFavoritesButton.BackgroundImage = myFavoritesNormalBackground; promotionsButton.BackgroundImage = promotionsNormalBackground; deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground; + + activeButton.BackgroundImage = activeBackground; } } diff --git a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.BopomofoSearch.cs b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.BopomofoSearch.cs index 8738a58..e278189 100644 --- a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.BopomofoSearch.cs +++ b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.BopomofoSearch.cs @@ -40,12 +40,8 @@ namespace DualScreenDemo private void ZhuyinSearchSingersButton_Click(object sender, EventArgs e) { // 設定按鈕背景,將「注音搜尋」設為啟動狀態,其餘按鈕恢復為正常狀態 - zhuyinSearchButton.BackgroundImage = zhuyinSearchActiveBackground; - englishSearchButton.BackgroundImage = englishSearchNormalBackground; - pinyinSearchButton.BackgroundImage = pinyinSearchNormalBackground; - wordCountSearchButton.BackgroundImage = wordCountSearchNormalBackground; - handWritingSearchButton.BackgroundImage = handWritingSearchNormalBackground; + UpdateButtonBackgrounds(zhuyinSearchButton, zhuyinSearchActiveBackground); // 載入設定檔,取得圖片路徑資訊 var configData = LoadConfigData(); diff --git a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.cs b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.cs index b405fb6..9887886 100644 --- a/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.cs +++ b/PrimaryFormParts/SingerSearch/PrimaryForm.SingerSearch.cs @@ -1,4 +1,3 @@ -using System.IO; namespace DualScreenDemo { @@ -24,11 +23,21 @@ namespace DualScreenDemo private Bitmap handWritingSearchNormalBackground; private Bitmap handWritingSearchActiveBackground; + 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; + } + private void SingerSearchButton_Click(object sender, EventArgs e) { - ResetPrimaryBtnStatus(); - singerSearchButton.BackgroundImage = singerSearchActiveBackground; + UpdateButtonBackgrounds(singerSearchButton, singerSearchActiveBackground); isOnOrderedSongsPage = false; /* 清空搜尋欄 */ @@ -83,30 +92,22 @@ namespace DualScreenDemo private void InitializeButtonsForSingerSearch() { + var data = LoadBtnConfigData(); - 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")); + InitializeButton(ref zhuyinSearchButton, ref zhuyinSearchNormalBackground, ref zhuyinSearchActiveBackground, "zhuyinSearchButton", 1197, 225, 225, 50, data["SingerSearch"]["ZhuYinSingerNormal"], data["SingerSearch"]["ZhuYinSingerActive"], ZhuyinSearchSingersButton_Click); - InitializeSearchButton(ref zhuyinSearchButton, "zhuyinSearchButton", 1197, 225, 225, 50, ref zhuyinSearchNormalBackground, ref zhuyinSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, ZhuyinSearchSingersButton_Click); + InitializeButton(ref englishSearchButton, ref englishSearchNormalBackground, ref englishSearchActiveBackground, "englishSearchButton", 1197, 280, 225, 50, data["SingerSearch"]["EngSingerNormal"], data["SingerSearch"]["EngSingerActive"], EnglishSearchSingersButton_Click); - InitializeSearchButton(ref englishSearchButton, "englishSearchButton", 1197, 280, 225, 50, ref englishSearchNormalBackground, ref englishSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, EnglishSearchSingersButton_Click); + InitializeButton(ref pinyinSearchButton, ref pinyinSearchNormalBackground, ref pinyinSearchActiveBackground, "pinyinSearchButton", 1197, 335, 225, 50, data["SingerSearch"]["PinYinSingerNormal"], data["SingerSearch"]["PinYinSingerActive"], PinyinSingerSearchButton_Click); - InitializeSearchButton(ref pinyinSearchButton, "pinyinSearchButton", 1197, 335, 225, 50, ref pinyinSearchNormalBackground, ref pinyinSearchActiveBackground, normalStateImageArtistQuery, mouseDownImageArtistQuery, PinyinSingerSearchButton_Click); + InitializeButton(ref wordCountSearchButton, ref wordCountSearchNormalBackground, ref wordCountSearchActiveBackground, "wordCountSearchButton", 1197, 390, 225, 50, data["SingerSearch"]["WordCntSingerNormal"], data["SingerSearch"]["WordCntSingerActive"], WordCountSearchSingersButton_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); + InitializeButton(ref handWritingSearchButton, ref handWritingSearchNormalBackground, ref handWritingSearchActiveBackground, "handWritingSearchButton", 1197, 445, 225, 50, data["SingerSearch"]["EngSingerNormal"], data["SingerSearch"]["EngSingerActive"], 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) diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs index c4809bc..d0edffd 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs @@ -23,13 +23,8 @@ namespace DualScreenDemo private void ZhuyinSearchSongsButton_Click(object sender, EventArgs e) { //更新搜尋模式按鈕的背景圖 - zhuyinSearchSongButton.BackgroundImage = zhuyinSearchSongActiveBackground; - englishSearchSongButton.BackgroundImage = englishSearchSongNormalBackground; - pinyinSearchSongButton.BackgroundImage = pinyinSearchSongNormalBackground; - wordCountSearchSongButton.BackgroundImage = wordCountSearchSongNormalBackground; - handWritingSearchSongButton.BackgroundImage = handWritingSearchSongNormalBackground; - numberSearchSongButton.BackgroundImage = numberSearchSongNormalBackground; + UpdateSongSearchBtn(zhuyinSearchSongButton,zhuyinSearchSongActiveBackground); // 讀取 config.ini 並獲取注音圖片的路徑 var configData = LoadConfigData(); string imagePath = Path.Combine(serverPath, configData["ImagePaths"]["ZhuYinSongs"]); diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs index 3a40cf1..ee2f688 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs @@ -28,6 +28,20 @@ namespace DualScreenDemo private Bitmap numberSearchSongNormalBackground; private Bitmap numberSearchSongActiveBackground; + + private void UpdateSongSearchBtn(Button activeButton, Image activeBackground) + { + zhuyinSearchSongButton.BackgroundImage = zhuyinSearchSongNormalBackground; + englishSearchSongButton.BackgroundImage = englishSearchSongNormalBackground; + pinyinSearchSongButton.BackgroundImage = pinyinSearchSongNormalBackground; + wordCountSearchSongButton.BackgroundImage = wordCountSearchSongNormalBackground; + handWritingSearchSongButton.BackgroundImage = handWritingSearchSongNormalBackground; + numberSearchSongButton.BackgroundImage = numberSearchSongNormalBackground; + + activeButton.BackgroundImage = activeBackground; + } + + /// /// 點擊「歌曲搜尋」按鈕時的事件處理函式 /// 1. 更新導航按鈕的背景圖片,使「歌曲搜尋」按鈕顯示為啟動狀態 @@ -36,21 +50,9 @@ namespace DualScreenDemo /// private void SongSearchButton_Click(object sender, EventArgs e) { - // 更新導航按鈕的背景圖片 - newSongAlertButton.BackgroundImage = newSongAlertNormalBackground; - hotPlayButton.BackgroundImage = hotPlayNormalBackground; - singerSearchButton.BackgroundImage = singerSearchNormalBackground; - songSearchButton.BackgroundImage = songSearchActiveBackground; - songSearchButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_歌名查詢(已按).png")); - languageSearchButton.BackgroundImage = languageSearchNormalBackground; - groupSearchButton.BackgroundImage = groupSearchNormalBackground; - categorySearchButton.BackgroundImage = categorySearchNormalBackground; - orderedSongsButton.BackgroundImage = orderedSongsNormalBackground; - myFavoritesButton.BackgroundImage = myFavoritesNormalBackground; - promotionsButton.BackgroundImage = promotionsNormalBackground; - deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground; - isOnOrderedSongsPage = false; + isOnOrderedSongsPage = false; + UpdateButtonBackgrounds(songSearchButton, songSearchActiveBackground); ResetinputBox(); string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' LIMIT 1000;"; var searchResult = SearchSongs_Mysql(query); @@ -64,7 +66,7 @@ namespace DualScreenDemo // 隱藏其他 UI SetHotSongButtonsVisibility(false); SetNewSongButtonsVisibility(false); - SetSingerSearchButtonsVisibility(false); + SetSongSearchButtonsVisibility(false); SetPictureBoxLanguageButtonsVisibility(false); SetGroupButtonsVisibility(false); SetPictureBoxCategoryAndButtonsVisibility(false); @@ -122,49 +124,26 @@ namespace DualScreenDemo /// private void InitializeButtonsForSongSearch() { - zhuyinSearchSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_注音查詢(未按).png")); - zhuyinSearchSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_注音查詢(已按).png")); - englishSearchSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_英文查詢(未按).png")); - englishSearchSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_英文查詢(已按).png")); - wordCountSearchSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_字數查詢(未按).png")); - wordCountSearchSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_字數查詢(已按).png")); - pinyinSearchSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_拼音查詢(未按).png")); - pinyinSearchSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_拼音查詢(已按).png")); - handWritingSearchSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_手寫查詢(未按).png")); - handWritingSearchSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_手寫查詢(已按).png")); - numberSearchSongNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_編號查詢(未按).png")); - numberSearchSongActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\4.歌名查詢_編號查詢(已按).png")); + + var data = LoadBtnConfigData(); + + InitializeButton(ref zhuyinSearchSongButton, ref zhuyinSearchSongNormalBackground, ref zhuyinSearchSongActiveBackground, "zhuyinSearchSongButton", 1197, 225, 225, 50, data["SongSearch"]["ZhuYinSongNormal"], data["SongSearch"]["ZhuYinSongActive"], ZhuyinSearchSongsButton_Click); - // 初始化「注音搜尋」按鈕 - InitializeSearchButton(ref zhuyinSearchSongButton, "zhuyinSearchSongButton", - 1197, 225, 225, 50, ref zhuyinSearchSongNormalBackground, ref zhuyinSearchSongActiveBackground, - normalStateImageSongQuery, mouseDownImageSongQuery, ZhuyinSearchSongsButton_Click); + InitializeButton(ref englishSearchSongButton, ref englishSearchSongNormalBackground, ref englishSearchSongActiveBackground, "englishSearchSongButton", 1197, 280, 225, 50, data["SongSearch"]["EngSongNormal"], data["SongSearch"]["EngSongActive"], EnglishSearchSongsButton_Click); - // 初始化「英文搜尋」按鈕 - InitializeSearchButton(ref englishSearchSongButton, "englishSearchSongButton", - 1197, 280, 225, 50, ref englishSearchSongNormalBackground, ref englishSearchSongActiveBackground, - normalStateImageSongQuery, mouseDownImageSongQuery, EnglishSearchSongsButton_Click); - // 初始化「拼音搜尋」按鈕 - InitializeSearchButton(ref pinyinSearchSongButton, "pinyinSearchSongButton", - 1197, 335, 225, 50, ref pinyinSearchSongNormalBackground, ref pinyinSearchSongActiveBackground, - normalStateImageSongQuery, mouseDownImageSongQuery, PinyinSearchSongsButton_Click); + InitializeButton(ref pinyinSearchSongButton, ref pinyinSearchSongNormalBackground, ref pinyinSearchSongActiveBackground, "pinyinSearchSongButton", 1197, 335, 225, 50, data["SongSearch"]["PinYingNormal"], data["SongSearch"]["PinYingActive"], PinyinSearchSongsButton_Click); - // 初始化「筆劃搜尋」按鈕 - InitializeSearchButton(ref wordCountSearchSongButton, "wordCountSearchSongButton", - 1197, 390, 225, 50, ref wordCountSearchSongNormalBackground, ref wordCountSearchSongActiveBackground, - normalStateImageSongQuery, mouseDownImageSongQuery, WordCountSearchSongsButton_Click); - // 初始化「手寫搜尋」按鈕 - InitializeSearchButton(ref handWritingSearchSongButton, "handWritingSearchSongButton", - 1197, 445, 225, 50, ref handWritingSearchSongNormalBackground, ref handWritingSearchSongActiveBackground, - normalStateImageSongQuery, mouseDownImageSongQuery, HandWritingSearchButtonForSongs_Click); + InitializeButton(ref wordCountSearchSongButton, ref wordCountSearchSongNormalBackground, ref wordCountSearchSongActiveBackground, "wordCountSearchSongButton", 1197, 390, 225, 50, data["SongSearch"]["WordCntSongNormal"], data["SongSearch"]["WordCntSongActive"], WordCountSearchSongsButton_Click); + + + InitializeButton(ref handWritingSearchSongButton, ref handWritingSearchSongNormalBackground, ref handWritingSearchSongActiveBackground, "handWritingSearchSongButton", 1197, 445, 225, 50, data["SongSearch"]["HWritingSongNormal"], data["SongSearch"]["HWritingSongActive"], HandWritingSearchButtonForSongs_Click); + + + InitializeButton(ref numberSearchSongButton, ref numberSearchSongNormalBackground, ref numberSearchSongActiveBackground, "numberSearchSongButton", 1197, 500, 225, 50, data["SongSearch"]["IDSearchNormal"], data["SongSearch"]["IDSearchActive"], SongIDSearchSongsButton_Click); - // 初始化「數字搜尋」按鈕 - InitializeSearchButton(ref numberSearchSongButton, "numberSearchSongButton", - 1197, 500, 225, 50, ref numberSearchSongNormalBackground, ref numberSearchSongActiveBackground, - normalStateImageSongQuery, mouseDownImageSongQuery, SongIDSearchSongsButton_Click); } } }