From 77ac202847ad3d41742485c18f635537fe996b4c Mon Sep 17 00:00:00 2001 From: jasonchenwork Date: Tue, 18 Mar 2025 14:57:49 +0800 Subject: [PATCH] =?UTF-8?q?SongSearch=E8=A8=BB=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PrimaryForm.SongSearch.BopomofoSearch.cs | 9 ++++++--- .../PrimaryForm.SongSearch.EnglishSearch.cs | 14 ++++++++------ .../SongSearch/PrimaryForm.SongSearch.cs | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs index 7c6eaa8..dcae270 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.BopomofoSearch.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using IniParser; using IniParser.Model; using System.Text; - +/* Song Search with ZhuYin */ namespace DualScreenDemo { public partial class PrimaryForm @@ -32,6 +32,8 @@ namespace DualScreenDemo var configData = LoadConfigData(); + /* 抓注音圖檔(ZhuYinSongs) 來自configData的資料 */ + /* 要確認路經需確認configData內容值 */ string imagePath = Path.Combine(Application.StartupPath, configData["ImagePaths"]["ZhuYinSongs"]); ShowImageOnPictureBoxZhuYinSongs(Path.Combine(Application.StartupPath, imagePath)); @@ -45,7 +47,7 @@ namespace DualScreenDemo SetZhuYinSongsAndButtonsVisibility(true); pictureBoxZhuYinSongs.Visible = true; } - + /* 初始化拼音按鈕 */ private void InitializePhoneticButtonsForSongs() { var data = LoadConfigData(); @@ -61,7 +63,7 @@ namespace DualScreenDemo CreatePhoneticButtonForSongs(i, buttonImages.normal, buttonImages.mouseDown, buttonImages.mouseOver); } } - + /* 按鈕設置顯示方式 可參考按鈕事件寫法 */ private void CreatePhoneticButtonForSongs(int index, string normalImagePath, string mouseDownImagePath, string mouseOverImagePath) { try @@ -210,6 +212,7 @@ namespace DualScreenDemo inputBoxZhuYinSongs.TextChanged += (sender, e) => { + /* 搜尋結果顯示到前歌單點選 */ string searchText = inputBoxZhuYinSongs.Text; var searchResults = allSongs.Where(song => song.PhoneticNotation.StartsWith(searchText)).ToList(); currentPage = 0; diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs index ac459a9..19de466 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.EnglishSearch.cs @@ -7,11 +7,12 @@ using System.Drawing; using IniParser; using IniParser.Model; using System.Text; - +/* 歌曲查詢 英文輸入 */ namespace DualScreenDemo { public partial class PrimaryForm { + /* 主頁面設計 */ private PictureBox pictureBoxEnglishSongs; private Button[] numberButtonsForSongs; @@ -53,7 +54,7 @@ namespace DualScreenDemo var data = LoadConfigData(); numberButtonCoords = LoadButtonCoordinates(data, "NumberButtonCoordinates", 10); var buttonImages = LoadButtonImages(data, "NumberButtonImages", 10); - + /* 按鈕圖片路徑設置 */ numberButtonsForSongs = new Button[10]; for (int i = 0; i < 10; i++) { @@ -81,7 +82,7 @@ namespace DualScreenDemo this.Controls.Add(numberButtonsForSongs[i]); } } - + /* 按鈕按下事件 */ private void NumberButtonForSongs_Click(object sender, EventArgs e) { @@ -95,6 +96,7 @@ namespace DualScreenDemo } } + /* 鍵盤對應按鈕位置 */ private void InitializeLetterButtonsForEnglishSongs() { var data = LoadConfigData(); @@ -227,7 +229,7 @@ namespace DualScreenDemo } private void InitializeInputBoxEnglishSongs() - { + { /* 英文輸入介面設定,參考 config.ini */ try { var parser = new FileIniDataParser(); @@ -260,7 +262,7 @@ namespace DualScreenDemo }; ResizeAndPositionControl(inputBoxEnglishSongs, x, y, width, height); - + /*搜尋結果 傳回點歌介面*/ inputBoxEnglishSongs.TextChanged += (sender, e) => { string searchText = inputBoxEnglishSongs.Text; @@ -280,7 +282,7 @@ namespace DualScreenDemo Console.WriteLine($"An error occurred: {ex.Message}"); } } - + /* 圖片位置設置 */ private void ShowImageOnPictureBoxEnglishSongs(string imagePath) { try diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs index 4ae7d07..37823f2 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.cs @@ -4,6 +4,7 @@ using System.Windows.Forms; namespace DualScreenDemo { + /* 建構子創立,程式進入初始位置,所有搜尋初始化設置 */ public partial class PrimaryForm { private Button zhuyinSearchSongButton;