btnReturn改寫(dictionary)
This commit is contained in:
parent
50b2126e5b
commit
01286c688f
@ -2963,16 +2963,39 @@ public class MultiPagePanel : Panel
|
|||||||
/// <param name="controls"></param>
|
/// <param name="controls"></param>
|
||||||
private void FindFirstNonEmptyText(params Control[] controls)
|
private void FindFirstNonEmptyText(params Control[] controls)
|
||||||
{
|
{
|
||||||
|
var searchActions = new Dictionary<Control, Action>
|
||||||
|
{
|
||||||
|
{ inputBoxZhuYinSingers, FindZhuYiSingers },
|
||||||
|
{ inputBoxZhuYinSongs, FindZhuYiSongs },
|
||||||
|
{ inputBoxEnglishSingers, FindEnglishSingers },
|
||||||
|
{ inputBoxEnglishSongs, FindEnglishSongs },
|
||||||
|
{ inputBoxPinYinSingers, FindPinYinSingers },
|
||||||
|
{ inputBoxPinYinSongs, FindPinYinSongs },
|
||||||
|
{ inputBoxWordCountSingers, FindWordCountSingers },
|
||||||
|
{ inputBoxWordCountSongs, FindWordCountSongs },
|
||||||
|
{ inputBoxSongIDSearch, FindNumberSongs },
|
||||||
|
{ handwritingInputBoxForSongs, FindHandwritingSongs },
|
||||||
|
{ handwritingInputBoxForSingers, FindHandwritingSingers },
|
||||||
|
};
|
||||||
|
|
||||||
foreach (var control in controls)
|
foreach (var control in controls)
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(control.Text))
|
if (!string.IsNullOrEmpty(control.Text))
|
||||||
{
|
{
|
||||||
var temp = control.Text;
|
var temp = control.Text;
|
||||||
ResetinputBox();
|
ResetinputBox(); // 清除所有輸入框
|
||||||
control.Text = temp;
|
control.Text = temp; // 還原唯一有內容的那個
|
||||||
|
|
||||||
|
if (searchActions.TryGetValue(control, out var action))
|
||||||
|
{
|
||||||
|
action.Invoke(); // 執行對應的查詢方法
|
||||||
|
}
|
||||||
|
|
||||||
|
break; // 只處理第一個有文字的輸入框
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 重置所有輸入框
|
/// 重置所有輸入框
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -515,11 +515,11 @@ namespace DualScreenDemo
|
|||||||
pictureBoxZhuYinSingers.Visible = false;
|
pictureBoxZhuYinSingers.Visible = false;
|
||||||
// 關閉注音搜尋的按鈕顏色
|
// 關閉注音搜尋的按鈕顏色
|
||||||
zhuyinSearchButton.BackgroundImage = zhuyinSearchNormalBackground;
|
zhuyinSearchButton.BackgroundImage = zhuyinSearchNormalBackground;
|
||||||
FindBopomofoSingers();
|
FindZhuYiSingers();
|
||||||
// 隱藏與 ZhuYin 歌手相關的所有按鈕
|
// 隱藏與 ZhuYin 歌手相關的所有按鈕
|
||||||
SetZhuYinSingersAndButtonsVisibility(false);
|
SetZhuYinSingersAndButtonsVisibility(false);
|
||||||
}
|
}
|
||||||
private void FindBopomofoSingers(){
|
private void FindZhuYiSingers(){
|
||||||
string searchText = inputBoxZhuYinSingers.Text;
|
string searchText = inputBoxZhuYinSingers.Text;
|
||||||
string query = $"SELECT * FROM ArtistLibrary WHERE `歌手注音` LIKE '{searchText}%' ";
|
string query = $"SELECT * FROM ArtistLibrary WHERE `歌手注音` LIKE '{searchText}%' ";
|
||||||
var searchResults = SearchSingers_Mysql(query);
|
var searchResults = SearchSingers_Mysql(query);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user