歌曲編號SQL查詢+變數型態調整
This commit is contained in:
parent
8d66c5e408
commit
ae8e4424e4
@ -1970,7 +1970,7 @@ public class MultiPagePanel : Panel
|
||||
{
|
||||
string searchText = artistLabel.Text; // 取得輸入內容
|
||||
string query = $"SELECT * FROM SongLibrary WHERE `歌星 A` = '{searchText}' OR `歌星 B` = '{searchText}'";
|
||||
List<SongData> searchResults = PrimaryForm.Instance.SearchSongs_Mysql(query);
|
||||
var searchResults = PrimaryForm.Instance.SearchSongs_Mysql(query);
|
||||
// 重置分頁
|
||||
PrimaryForm.Instance.currentPage = 0;
|
||||
currentSongList = searchResults;
|
||||
|
@ -3,6 +3,7 @@ using System.Drawing.Imaging;
|
||||
using IniParser;
|
||||
using IniParser.Model;
|
||||
using System.Text;
|
||||
|
||||
/*
|
||||
WordCountSongs -> SongIDSearch
|
||||
WordCount -> SongID
|
||||
@ -537,8 +538,26 @@ namespace DualScreenDemo
|
||||
numberSearchSongButton.BackgroundImage = numberSearchSongNormalBackground;
|
||||
// 隱藏與 SongID 歌手相關的所有按鈕
|
||||
SetSongIDSearchAndButtonsVisibility(false);
|
||||
FindNumberSongs(); // 搜尋歌曲
|
||||
}
|
||||
|
||||
private void FindNumberSongs(){
|
||||
string searchText = inputBoxSongIDSearch.Text;
|
||||
// 在這裡添加搜尋歌曲的邏輯
|
||||
// 例如:根據輸入框的內容搜尋歌曲
|
||||
string query = $"SELECT * FROM SongLibrary WHERE `歌曲編號` = '{searchText}' ";
|
||||
|
||||
var searchResults = SearchSongs_Mysql(query);
|
||||
// 重置分頁
|
||||
currentPage = 0;
|
||||
currentSongList = searchResults;
|
||||
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
||||
// 更新多頁面面板的內容
|
||||
multiPagePanel.currentPageIndex = 0;
|
||||
multiPagePanel.LoadSongs(currentSongList);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 創建一個特殊的按鈕,並設定其顯示屬性、事件處理和位置。
|
||||
@ -604,7 +623,7 @@ namespace DualScreenDemo
|
||||
ResizeAndPositionControl(inputBoxSongIDSearch, inputBoxSongIDCoords.X, inputBoxSongIDCoords.Y, inputBoxSongIDCoords.Width, inputBoxSongIDCoords.Height);
|
||||
|
||||
// 設定文本變更事件,當輸入框內容改變時觸發
|
||||
inputBoxSongIDSearch.TextChanged += (sender, e) =>
|
||||
/*inputBoxSongIDSearch.TextChanged += (sender, e) =>
|
||||
{
|
||||
string searchText = inputBoxSongIDSearch.Text; // 取得輸入內容
|
||||
|
||||
@ -619,7 +638,7 @@ namespace DualScreenDemo
|
||||
// 更新多頁面面板的內容
|
||||
multiPagePanel.currentPageIndex = 0;
|
||||
multiPagePanel.LoadSongs(currentSongList);
|
||||
};
|
||||
};*/
|
||||
|
||||
// 將輸入框加入到窗體的控件集合中
|
||||
this.Controls.Add(inputBoxSongIDSearch);
|
||||
|
@ -258,6 +258,24 @@ namespace DualScreenDemo
|
||||
pinyinSearchSongButton.BackgroundImage = pinyinSearchSongNormalBackground;
|
||||
// 設定拼音輸入框與所有相關按鈕的可見性為 false
|
||||
SetPinYinSongsAndButtonsVisibility(false);
|
||||
FindPinYinSongs();
|
||||
|
||||
}
|
||||
private void FindPinYinSongs(){
|
||||
string searchText = inputBoxPinYinSongs.Text;
|
||||
// 在這裡添加搜尋歌曲的邏輯
|
||||
// 例如:根據輸入框的內容搜尋歌曲
|
||||
string query = $"SELECT * FROM SongLibrary WHERE `歌曲拼音` LIKE '{searchText}%' ";
|
||||
|
||||
var searchResults = SearchSongs_Mysql(query);
|
||||
// 重置分頁
|
||||
currentPage = 0;
|
||||
currentSongList = searchResults;
|
||||
totalPages = (int)Math.Ceiling((double)searchResults.Count / itemsPerPage);
|
||||
// 更新多頁面面板的內容
|
||||
multiPagePanel.currentPageIndex = 0;
|
||||
multiPagePanel.LoadSongs(currentSongList);
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
@ -312,7 +330,7 @@ namespace DualScreenDemo
|
||||
ResizeAndPositionControl(inputBoxPinYinSongs, x, y, width, height);
|
||||
|
||||
// **綁定 TextChanged 事件 (當輸入內容改變時觸發搜尋)**
|
||||
inputBoxPinYinSongs.TextChanged += (sender, e) =>
|
||||
/*inputBoxPinYinSongs.TextChanged += (sender, e) =>
|
||||
{
|
||||
string searchText = inputBoxPinYinSongs.Text;
|
||||
|
||||
@ -326,7 +344,7 @@ namespace DualScreenDemo
|
||||
// 更新 UI,顯示搜尋結果
|
||||
multiPagePanel.currentPageIndex = 0;
|
||||
multiPagePanel.LoadSongs(currentSongList);
|
||||
};
|
||||
};*/
|
||||
|
||||
// 將拼音輸入框加入視窗中
|
||||
this.Controls.Add(inputBoxPinYinSongs);
|
||||
|
@ -1,7 +0,0 @@
|
||||
namespace DualScreenDemo
|
||||
{
|
||||
public partial class PrimaryForm
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -3,7 +3,6 @@ using System.Drawing.Imaging;
|
||||
using IniParser;
|
||||
using IniParser.Model;
|
||||
using System.Text;
|
||||
using DBObj;
|
||||
|
||||
|
||||
/*
|
||||
@ -561,7 +560,7 @@ namespace DualScreenDemo
|
||||
query = string.Empty; // 清空查詢
|
||||
return;
|
||||
}
|
||||
List<SongData> searchResults = SearchSongs_Mysql(query);
|
||||
var searchResults = SearchSongs_Mysql(query);
|
||||
// 重置分頁
|
||||
currentPage = 0;
|
||||
currentSongList = searchResults;
|
||||
|
Loading…
x
Reference in New Issue
Block a user