This commit is contained in:
jasonchenwork 2025-08-08 16:42:18 +08:00
commit be3f05122d
11 changed files with 92 additions and 115 deletions

View File

@ -71,7 +71,7 @@ namespace DBObj
}
public List<SongData> 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)

View File

@ -1,6 +1,7 @@
using DualScreenDemo;
using System;
using System.IO;
using System.Numerics;
using System.Windows.Navigation;
namespace DBObj
{
@ -8,10 +9,10 @@ namespace DBObj
{
private static bool isWelcome = true;
public static SongData welcome;
public static SongData close ;
private static SongData publicPlaying=null;
public static SongData close;
private static SongData publicPlaying = null;
private static List<SongData> publicSong = new();
private static SongData playing=null;
private static SongData playing = null;
private static List<SongData> not_played = new List<SongData>();
private static List<SongData> played = new List<SongData>();
public static List<SongData> PublicSong() => publicSong;
@ -19,7 +20,7 @@ namespace DBObj
public static SongData Current()
{
Console.WriteLine(not_played.Count + " Current " + playing);
return (playing ==null) ? publicPlaying : playing;
return (playing == null) ? publicPlaying : playing;
}
public static SongData Next()
{
@ -57,12 +58,17 @@ namespace DBObj
}
private static SongData NextPublicSong()
{
if (Program.room.IsClose()) {
if (Program.room.IsClose())
{
publicPlaying = close;
} else if(Program.room.IsOpen() && isWelcome){
}
else if (Program.room.IsOpen() && isWelcome)
{
isWelcome = false;
publicPlaying = welcome;
} else {
}
else
{
publicPlaying = publicSong[0];
publicSong.RemoveAt(0);
publicSong.Add(publicPlaying);
@ -93,10 +99,19 @@ namespace DBObj
}
}
public static void Cancel(SongData song)
{
not_played.Remove(song);
played.Remove(song);
chkCut();
}
public static void Insert(SongData song)
{
if (song.FileExistsInServers()) {
not_played.Insert(0, new SongData(song,PlayState.InsertPlayback));
if (song.FileExistsInServers())
{
not_played.Insert(0, new SongData(song, PlayState.InsertPlayback));
chkCut();
}
else
@ -113,16 +128,21 @@ namespace DBObj
PrimaryForm.Instance.Invoke(new System.Action(() => PrimaryForm.Instance.videoPlayerForm.PlayNextSong()));
else
PrimaryForm.Instance.videoPlayerForm.PlayNextSong();
} else {
}
else
{
UpdateNextSongLabel();
}
}
public static void UpdateNextSongLabel()
{
if (Program.room.IsClose()) {
if (Program.room.IsClose())
{
VideoPlayerForm.overlayForm.UpdateTopLeftLabel(" ");
} else {
}
else
{
VideoPlayerForm.overlayForm.UpdateTopLeftLabel(
(not_played.Count > 0) ? not_played[0].next_song_text() : "目前沒有下一首,請踴躍點歌!!!"
);

View File

@ -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();*/

View File

@ -6,7 +6,7 @@ namespace DualScreenDemo
{
ResetCatBtnStatus();
loveDuetButton.BackgroundImage = loveDuetActiveBackground;
/*loveDuetSongs = allSongs.Where(song => song.SongGenre.Contains("A1"))
.OrderByDescending(song => song.Plays)
.ToList();*/

View File

@ -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();*/

View File

@ -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();*/

View File

@ -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();*/

View File

@ -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();*/

View File

@ -5,7 +5,7 @@ namespace DualScreenDemo
private void VietnameseSongsButton_Click(object sender, EventArgs e)
{
ResetCatBtnStatus();
vietnameseSongsButton.BackgroundImage = vietnameseActiveBackground;
/*vietnameseSongs = allSongs.Where(song => song.SongGenre.Contains("G1"))
.OrderByDescending(song => song.Plays)
.ToList();*/

View File

@ -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;

View File

@ -24,6 +24,20 @@ namespace DualScreenDemo
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,
@ -33,6 +47,8 @@ namespace DualScreenDemo
VodButton_Click);
vodButton.Visible = false;
}
insertButton = new Button();
@ -99,11 +115,21 @@ namespace DualScreenDemo
this.Controls.Add(vodScreenCloseButton);
}
private void VodButton_Click(object sender, EventArgs e)
{
if (isOnOrderedSongsPage)
{
SetVodScreenPictureBoxAndButtonsVisibility(false);
SongList.Cancel(currentSelectedSong);
orderedSongsButton.PerformClick();
}
else
{
SetVodScreenPictureBoxAndButtonsVisibility(false);
SongList.Add(currentSelectedSong);
}
}
private void InsertButton_Click(object sender, EventArgs e)
{
SetVodScreenPictureBoxAndButtonsVisibility(false);