優化顯示,移除部分顯示BUG

This commit is contained in:
jasonchenwork 2025-04-23 13:55:11 +08:00
parent 924d6229e7
commit 19a672eef0
9 changed files with 34 additions and 11 deletions

View File

@ -4,14 +4,15 @@ namespace DBObj
public class Artist
{
public string Name { get; set; }
public string NameSimplified{get;set;}
//public string Phonetic { get; set; }
//public string Category { get; set; }
//public int Strokes { get; set; }
public Artist(string name)
public Artist(string name,string nameSimplified)
{
Name = name;
NameSimplified=nameSimplified;
}
public override string ToString()

View File

@ -55,11 +55,11 @@ namespace DBObj
}
*/
public List<SongData> SearchNewSongs(){
string query= $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY add_date DESC LIMIT {PrimaryForm.ReadNewSongLimit()}";
string query= $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY add_date DESC LIMIT {PrimaryForm.ReadNewSongLimit()}";
return PrimaryForm.Instance.SearchSongs_Mysql(query);
}
public List<SongData> SearchHotSongs(){
string query= $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY add_date DESC LIMIT {PrimaryForm.ReadHotSongLimit()}";
string query= $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY add_date DESC LIMIT {PrimaryForm.ReadHotSongLimit()}";
return PrimaryForm.Instance.SearchSongs_Mysql(query);
}
public List<SongData> SearchSongsBySinger(string keyword)

View File

@ -180,6 +180,8 @@ namespace DualScreenDemo
/*loveDuetSongs = allSongs.Where(song => song.SongGenre.Contains("A1"))
.OrderByDescending(song => song.Plays)
.ToList();*/
/* 清空搜尋欄 */
ResetinputBox();
string query = SetQueryforSQL("A1");
var loveDuetSongs = SearchSongs_Mysql(query);
currentPage = 0;

View File

@ -131,6 +131,8 @@ namespace DualScreenDemo
/*guoYuSongs = allSongs.Where(song => song.Category == "國語" && (song.ArtistACategory == "團" || song.ArtistBCategory == "團"))
.OrderByDescending(song => song.Plays)
.ToList();*/
/* 清空搜尋欄 */
ResetinputBox();
string query = "SELECT * FROM song_library_cache WHERE language_name = '國語' AND (`artistA_category` = '團' OR `artistB_category` = '團') ORDER BY song_id DESC";
var guoYuSongs = SearchSongs_Mysql(query);
currentPage = 0;

View File

@ -60,7 +60,8 @@ namespace DualScreenDemo
UpdateButtonBackgrounds(hotPlayButton, hotPlayActiveBackground);
UpdateHotSongButtons(guoYuButtonHotSong, guoYuHotSongActiveBackground);
isOnOrderedSongsPage = false;
/* 清空搜尋欄 */
ResetinputBox();
int songLimit = ReadHotSongLimit();
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY `song_id` DESC LIMIT {songLimit}";
var guoYuSongs = SearchSongs_Mysql(query);

View File

@ -73,7 +73,8 @@ namespace DualScreenDemo
hanYuButton.BackgroundImage = hanYuNormalBackground;
keYuButton.BackgroundImage = keYuNormalBackground;
/* 清空搜尋欄 */
ResetinputBox();
string query = $"SELECT * FROM song_library_cache WHERE language_name = '國語' ORDER BY song_id DESC LIMIT 100";
var guoYuSongs = SearchSongs_Mysql(query);
currentPage = 0;

View File

@ -79,7 +79,8 @@ namespace DualScreenDemo
yingWenButtonNewSong.BackgroundImage = yingWenNewSongNormalBackground;
riYuButtonNewSong.BackgroundImage = riYuNewSongNormalBackground;
hanYuButtonNewSong.BackgroundImage = hanYuNewSongNormalBackground;
/* 清空搜尋欄 */
ResetinputBox();
/*guoYuSongs2 = allSongs.Where(song => song.Category == "國語")
.OrderByDescending(song => song.AddedTime)

View File

@ -45,7 +45,10 @@ namespace DualScreenDemo
if (_isSimplified != value)
{
_isSimplified = value;
RefreshDisplay();
if(currentArtistList != null && currentArtistList.Count > 0)
RefreshDisplayBase_Singer();
else
RefreshDisplay();
}
}
}
@ -249,7 +252,10 @@ namespace DualScreenDemo
// 創建歌手標籤
Label artistLabel = new Label();
artistLabel.Text = artist.Name;
string artistText = IsSimplified ?
(!string.IsNullOrEmpty(artist.NameSimplified) ? artist.NameSimplified : artist.Name) :
artist.Name;
artistLabel.Text = artistText;
artistLabel.Tag = artist;
artistLabel.AutoSize = false;
@ -324,7 +330,15 @@ namespace DualScreenDemo
{
string searchText = artistLabel.Text; // 取得輸入內容
// 歌星 轉 歌曲
string query = $"SELECT * FROM song_library_cache WHERE artistA ='{searchText}' OR artistB='{searchText}' ";
string query = IsSimplified ?
(
!string.IsNullOrEmpty(artist.NameSimplified)?
$"SELECT * FROM song_library_cache WHERE artistA_simplified = '{searchText}' OR artistB_simplified = '{searchText}'"
: $"SELECT * FROM song_library_cache WHERE artistA = '{searchText}' OR artistB = '{searchText}'"
)
: $"SELECT * FROM song_library_cache WHERE artistA = '{searchText}' OR artistB = '{searchText}'"
;
//string query = $"SELECT * FROM song_library_cache WHERE artistA ='{searchText}' OR artistB='{searchText}' ";
var searchResults = PrimaryForm.Instance.SearchSongs_Mysql(query);
// 重置分頁
PrimaryForm.Instance.currentPage = 0;

View File

@ -82,7 +82,8 @@ namespace DualScreenDemo{
while (reader.Read())
{
string artist = reader["name"].ToString();
searchResults.Add(new Artist(artist));
string artistSimplified = reader ["simplified"].ToString();
searchResults.Add(new Artist(artist,artistSimplified));
}
}
}