diff --git a/DBObj/Artist.cs b/DBObj/Artist.cs index 75c5ab0..8a5138c 100644 --- a/DBObj/Artist.cs +++ b/DBObj/Artist.cs @@ -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() diff --git a/DBObj/SongListManager.cs b/DBObj/SongListManager.cs index 2d5ed8b..c075840 100644 --- a/DBObj/SongListManager.cs +++ b/DBObj/SongListManager.cs @@ -55,11 +55,11 @@ namespace DBObj } */ public List 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 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 SearchSongsBySinger(string keyword) diff --git a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs index 730b727..3d24677 100644 --- a/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs +++ b/PrimaryFormParts/CategorySearch/PrimaryForm.CategorySearch.cs @@ -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; diff --git a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs index 2fa3546..93f3960 100644 --- a/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs +++ b/PrimaryFormParts/GroupSearch/PrimaryForm.GroupSearch.cs @@ -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; diff --git a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs index 4de5e94..2ea4e3f 100644 --- a/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs +++ b/PrimaryFormParts/HotSong/PrimaryForm.HotSong.cs @@ -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); diff --git a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs index 4c6ccba..f9af030 100644 --- a/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs +++ b/PrimaryFormParts/LanguageSearch/PrimaryForm.LanguageSearch.cs @@ -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; diff --git a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs index a666493..ad08f34 100644 --- a/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs +++ b/PrimaryFormParts/NewSongAlert/PrimaryForm.NewSongAlert.cs @@ -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) diff --git a/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs b/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs index e34cfa9..80cdae7 100644 --- a/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs +++ b/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs @@ -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; diff --git a/PrimaryFormParts/PrimaryForm.SQLSearch.cs b/PrimaryFormParts/PrimaryForm.SQLSearch.cs index 0c69e54..0fa7701 100644 --- a/PrimaryFormParts/PrimaryForm.SQLSearch.cs +++ b/PrimaryFormParts/PrimaryForm.SQLSearch.cs @@ -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)); } } }