From a4b397e8126ba4f11c51929e7e37a6e42d59b136 Mon Sep 17 00:00:00 2001 From: "allen.yan" Date: Fri, 8 Aug 2025 16:31:26 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E6=A9=9F=E6=AD=8C=E6=9B=B2=E6=9F=A5?= =?UTF-8?q?=E8=A9=A2=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DBObj/SQLManager.cs | 2 +- DBObj/SongList.cs | 13 +++ .../PrimaryForm.CategorySearch.ChinaSongs.cs | 2 +- .../PrimaryForm.CategorySearch.LoveDuet.cs | 2 +- .../PrimaryForm.CategorySearch.MedleyDance.cs | 2 +- .../PrimaryForm.CategorySearch.Nineties.cs | 2 +- ...imaryForm.CategorySearch.NostalgicSongs.cs | 2 +- .../PrimaryForm.CategorySearch.TalentShow.cs | 2 +- ...maryForm.CategorySearch.VietnameseSongs.cs | 4 +- .../PrimaryForm.CategorySearch.cs | 85 ++----------------- PrimaryFormParts/PrimaryForm.VodScreen.cs | 48 ++++++++--- 11 files changed, 67 insertions(+), 97 deletions(-) diff --git a/DBObj/SQLManager.cs b/DBObj/SQLManager.cs index 250dcaa..afd876e 100644 --- a/DBObj/SQLManager.cs +++ b/DBObj/SQLManager.cs @@ -71,7 +71,7 @@ namespace DBObj } public List SearchSongsByName(string keyword) { - string query = $"SELECT * FROM song_library_cache WHERE LOWER(song_name) LIKE CONCAT('%', LOWER('{keyword}'), '%');"; + string query = $"SELECT * FROM song_library_cache WHERE LOWER(song_name) LIKE CONCAT('%', LOWER('{keyword}'), '%') ORDER BY song_name DESC;"; return select_Mysql(query); } public SongData SearchSongByNumber(string songNumber) diff --git a/DBObj/SongList.cs b/DBObj/SongList.cs index 9e248e2..3fb7adc 100644 --- a/DBObj/SongList.cs +++ b/DBObj/SongList.cs @@ -1,6 +1,7 @@ using DualScreenDemo; using System; using System.IO; +using System.Numerics; using System.Windows.Navigation; namespace DBObj { @@ -93,6 +94,18 @@ namespace DBObj } } + + public static void Cancel(SongData song) + { + //if (song.FileExistsInServers()) + //{ + not_played.Remove(song); + played.Remove(song); + // PrimaryForm.Instance.AddSongCount(songData.Number); + chkCut(); + //} + } + public static void Insert(SongData song) { if (song.FileExistsInServers()) { diff --git a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.ChinaSongs.cs b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.ChinaSongs.cs index a62302c..fd9f3fd 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.ChinaSongs.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.ChinaSongs.cs @@ -5,7 +5,7 @@ namespace DualScreenDemo private void ChinaSongsButton_Click(object sender, EventArgs e) { ResetCatBtnStatus(); - + chinaSongsButton.BackgroundImage = 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 ea75180..6a57eac 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.LoveDuet.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.LoveDuet.cs @@ -6,7 +6,7 @@ namespace DualScreenDemo { ResetCatBtnStatus(); - + loveDuetButton.BackgroundImage = 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 10bca0b..06f24d9 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.MedleyDance.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.MedleyDance.cs @@ -5,7 +5,7 @@ namespace DualScreenDemo private void MedleyDanceButton_Click(object sender, EventArgs e) { ResetCatBtnStatus(); - + medleyDanceButton.BackgroundImage = 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 a0a37cb..c0a5c1a 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.Nineties.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.Nineties.cs @@ -5,7 +5,7 @@ namespace DualScreenDemo private void NinetiesButton_Click(object sender, EventArgs e) { ResetCatBtnStatus(); - + ninetiesButton.BackgroundImage = 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 c26ae74..4bd2ed5 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.NostalgicSongs.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.NostalgicSongs.cs @@ -5,7 +5,7 @@ namespace DualScreenDemo private void NostalgicSongsButton_Click(object sender, EventArgs e) { ResetCatBtnStatus(); - + nostalgicSongsButton.BackgroundImage = 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 ee43cb9..3674e55 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.TalentShow.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.TalentShow.cs @@ -5,7 +5,7 @@ namespace DualScreenDemo private void TalentShowButton_Click(object sender, EventArgs e) { ResetCatBtnStatus(); - + talentShowButton.BackgroundImage = 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 1dd7596..4a05b7f 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.VietnameseSongs.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.VietnameseSongs.cs @@ -4,8 +4,8 @@ namespace DualScreenDemo { private void VietnameseSongsButton_Click(object sender, EventArgs e) { - ResetCatBtnStatus(); - + ResetCatBtnStatus(); + vietnameseSongsButton.BackgroundImage = 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 8daa23d..e863625 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs @@ -62,91 +62,23 @@ namespace DualScreenDemo private void InitializeCategorySearchButtons() { - - loveDuetNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_男女情歌(未按).png")); - talentShowNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_選秀節目(未按).png")); - medleyDanceNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_串燒舞曲(未按).png")); - ninetiesNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_90年代(未按).png")); - nostalgicSongsNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_懷舊老歌(未按).png")); - chinaNormalBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_中國大陸(未按).png")); - vietnameseNormalBackground= new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_越南歌曲(未按).png")); - - loveDuetActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_男女情歌(已按).png")); - talentShowActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_選秀節目(已按).png")); - medleyDanceActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_串燒舞曲(已按).png")); - ninetiesActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_90年代(已按).png")); - nostalgicSongsActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_懷舊老歌(已按).png")); - chinaActiveBackground = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_中國大陸(已按).png")); - vietnameseActiveBackground= new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\2.次類別\\7.類別查詢_越南歌曲(已按).png")); - - loveDuetButton = new Button { Text = "", Visible = false }; - ConfigureButton(loveDuetButton, 1197, 225, 225, 50, - loveDuetNormalBackground, - loveDuetNormalBackground, - loveDuetActiveBackground, - LoveDuetButton_Click); - - loveDuetButton.MouseLeave += (sender, e) => loveDuetButton.BackgroundImage = loveDuetActiveBackground; + var data = LoadBtnConfigData(); - talentShowButton = new Button { Text = "", Visible = false }; - ConfigureButton(talentShowButton, 1197, 280, 225, 50, - talentShowNormalBackground, - talentShowNormalBackground, - talentShowNormalBackground, - TalentShowButton_Click); + InitializeButton(ref loveDuetButton, ref loveDuetNormalBackground, ref loveDuetActiveBackground, "loveDuetButton", 1197, 225, 225, 50, data["CategorySubBtn"]["LoveDuetNormal"], data["CategorySubBtn"]["LoveDuetActive"], LoveDuetButton_Click); - talentShowButton.MouseLeave += (sender, e) => talentShowButton.BackgroundImage = talentShowActiveBackground; + InitializeButton(ref talentShowButton, ref talentShowNormalBackground, ref talentShowActiveBackground, "talentShowButton", 1197, 280, 225, 50, data["CategorySubBtn"]["TalentNormal"], data["CategorySubBtn"]["TalentActive"], TalentShowButton_Click); + InitializeButton(ref medleyDanceButton, ref medleyDanceNormalBackground, ref medleyDanceActiveBackground, "medleyDanceButton", 1197, 335, 225, 50, data["CategorySubBtn"]["MedleyNormal"], data["CategorySubBtn"]["MedleyActive"], MedleyDanceButton_Click); - medleyDanceButton = new Button { Text = "", Visible = false }; - ConfigureButton(medleyDanceButton, 1197, 335, 225, 50, - medleyDanceNormalBackground, - medleyDanceNormalBackground, - medleyDanceNormalBackground, - MedleyDanceButton_Click); + InitializeButton(ref ninetiesButton, ref ninetiesNormalBackground, ref ninetiesActiveBackground, "ninetiesButton", 1197, 390, 225, 50, data["CategorySubBtn"]["NintiesNormail"], data["CategorySubBtn"]["NintiesActive"], NinetiesButton_Click); - medleyDanceButton.MouseLeave += (sender, e) => medleyDanceButton.BackgroundImage = medleyDanceActiveBackground; + InitializeButton(ref nostalgicSongsButton, ref nostalgicSongsNormalBackground, ref nostalgicSongsActiveBackground, "nostalgicSongsButton", 1197, 445, 225, 50, data["CategorySubBtn"]["NostalgicNormal"], data["CategorySubBtn"]["NostalgicActive"], NostalgicSongsButton_Click); + InitializeButton(ref chinaSongsButton, ref chinaNormalBackground, ref chinaActiveBackground, "chinaSongsButton", 1197, 500, 225, 50, data["CategorySubBtn"]["ChinaNormal"], data["CategorySubBtn"]["ChinaActive"], ChinaSongsButton_Click); - ninetiesButton = new Button { Text = "", Visible = false }; - ConfigureButton(ninetiesButton, 1197, 390, 225, 50, - ninetiesNormalBackground, - ninetiesNormalBackground, - ninetiesNormalBackground, - NinetiesButton_Click); + InitializeButton(ref vietnameseSongsButton, ref vietnameseNormalBackground, ref vietnameseActiveBackground, "vietnameseSongsButton", 1197, 555, 225, 50, data["CategorySubBtn"]["VietNormal"], data["CategorySubBtn"]["VietActive"], VietnameseSongsButton_Click); - ninetiesButton.MouseLeave += (sender, e) => ninetiesButton.BackgroundImage = ninetiesActiveBackground; - - - nostalgicSongsButton = new Button { Text = "", Visible = false }; - ConfigureButton(nostalgicSongsButton, 1197, 445, 225, 50, - nostalgicSongsNormalBackground, - nostalgicSongsNormalBackground, - nostalgicSongsNormalBackground, - NostalgicSongsButton_Click); - - nostalgicSongsButton.MouseLeave += (sender, e) => nostalgicSongsButton.BackgroundImage = nostalgicSongsActiveBackground; - - - chinaSongsButton = new Button { Text = "", Visible = false }; - ConfigureButton(chinaSongsButton, 1197, 500, 225, 50, - chinaNormalBackground, - chinaNormalBackground, - chinaNormalBackground, - ChinaSongsButton_Click); - - chinaSongsButton.MouseLeave += (sender, e) => chinaSongsButton.BackgroundImage = chinaActiveBackground; - - - vietnameseSongsButton = new Button { Text = "", Visible = false }; - ConfigureButton(vietnameseSongsButton, 1197, 555, 225, 50, - vietnameseNormalBackground, - vietnameseNormalBackground, - vietnameseNormalBackground, - VietnameseSongsButton_Click); - - vietnameseSongsButton.MouseLeave += (sender, e) => vietnameseSongsButton.BackgroundImage = vietnameseActiveBackground; } @@ -154,7 +86,6 @@ namespace DualScreenDemo { ResetPrimaryBtnStatus(); - //categorySearchButton.BackgroundImage = new Bitmap(Path.Combine(serverPath, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(已按).png")); categorySearchButton.BackgroundImage = categorySearchActiveBackground; isOnOrderedSongsPage = false; diff --git a/PrimaryFormParts/PrimaryForm.VodScreen.cs b/PrimaryFormParts/PrimaryForm.VodScreen.cs index f977cac..89f28ec 100644 --- a/PrimaryFormParts/PrimaryForm.VodScreen.cs +++ b/PrimaryFormParts/PrimaryForm.VodScreen.cs @@ -23,16 +23,32 @@ namespace DualScreenDemo int yPosition = (screenHeight - pictureBoxHeight) / 2; var data=LoadConfigData(); - - 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; + 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; + } + insertButton = new Button(); @@ -100,8 +116,18 @@ namespace DualScreenDemo } private void VodButton_Click(object sender, EventArgs e) { - SetVodScreenPictureBoxAndButtonsVisibility(false); - SongList.Add(currentSelectedSong); + if (isOnOrderedSongsPage) + { + SetVodScreenPictureBoxAndButtonsVisibility(false); + SongList.Cancel(currentSelectedSong); + orderedSongsButton.PerformClick(); + } + else + { + SetVodScreenPictureBoxAndButtonsVisibility(false); + SongList.Add(currentSelectedSong); + } + } private void InsertButton_Click(object sender, EventArgs e)