SongSearch註解
This commit is contained in:
parent
1e2983f79e
commit
77ac202847
@ -8,7 +8,7 @@ using System.Collections.Generic;
|
|||||||
using IniParser;
|
using IniParser;
|
||||||
using IniParser.Model;
|
using IniParser.Model;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
/* Song Search with ZhuYin */
|
||||||
namespace DualScreenDemo
|
namespace DualScreenDemo
|
||||||
{
|
{
|
||||||
public partial class PrimaryForm
|
public partial class PrimaryForm
|
||||||
@ -32,6 +32,8 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
|
|
||||||
var configData = LoadConfigData();
|
var configData = LoadConfigData();
|
||||||
|
/* 抓注音圖檔(ZhuYinSongs) 來自configData的資料 */
|
||||||
|
/* 要確認路經需確認configData內容值 */
|
||||||
string imagePath = Path.Combine(Application.StartupPath, configData["ImagePaths"]["ZhuYinSongs"]);
|
string imagePath = Path.Combine(Application.StartupPath, configData["ImagePaths"]["ZhuYinSongs"]);
|
||||||
|
|
||||||
ShowImageOnPictureBoxZhuYinSongs(Path.Combine(Application.StartupPath, imagePath));
|
ShowImageOnPictureBoxZhuYinSongs(Path.Combine(Application.StartupPath, imagePath));
|
||||||
@ -45,7 +47,7 @@ namespace DualScreenDemo
|
|||||||
SetZhuYinSongsAndButtonsVisibility(true);
|
SetZhuYinSongsAndButtonsVisibility(true);
|
||||||
pictureBoxZhuYinSongs.Visible = true;
|
pictureBoxZhuYinSongs.Visible = true;
|
||||||
}
|
}
|
||||||
|
/* 初始化拼音按鈕 */
|
||||||
private void InitializePhoneticButtonsForSongs()
|
private void InitializePhoneticButtonsForSongs()
|
||||||
{
|
{
|
||||||
var data = LoadConfigData();
|
var data = LoadConfigData();
|
||||||
@ -61,7 +63,7 @@ namespace DualScreenDemo
|
|||||||
CreatePhoneticButtonForSongs(i, buttonImages.normal, buttonImages.mouseDown, buttonImages.mouseOver);
|
CreatePhoneticButtonForSongs(i, buttonImages.normal, buttonImages.mouseDown, buttonImages.mouseOver);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* 按鈕設置顯示方式 可參考按鈕事件寫法 */
|
||||||
private void CreatePhoneticButtonForSongs(int index, string normalImagePath, string mouseDownImagePath, string mouseOverImagePath)
|
private void CreatePhoneticButtonForSongs(int index, string normalImagePath, string mouseDownImagePath, string mouseOverImagePath)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -210,6 +212,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
inputBoxZhuYinSongs.TextChanged += (sender, e) =>
|
inputBoxZhuYinSongs.TextChanged += (sender, e) =>
|
||||||
{
|
{
|
||||||
|
/* 搜尋結果顯示到前歌單點選 */
|
||||||
string searchText = inputBoxZhuYinSongs.Text;
|
string searchText = inputBoxZhuYinSongs.Text;
|
||||||
var searchResults = allSongs.Where(song => song.PhoneticNotation.StartsWith(searchText)).ToList();
|
var searchResults = allSongs.Where(song => song.PhoneticNotation.StartsWith(searchText)).ToList();
|
||||||
currentPage = 0;
|
currentPage = 0;
|
||||||
|
@ -7,11 +7,12 @@ using System.Drawing;
|
|||||||
using IniParser;
|
using IniParser;
|
||||||
using IniParser.Model;
|
using IniParser.Model;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
/* 歌曲查詢 英文輸入 */
|
||||||
namespace DualScreenDemo
|
namespace DualScreenDemo
|
||||||
{
|
{
|
||||||
public partial class PrimaryForm
|
public partial class PrimaryForm
|
||||||
{
|
{
|
||||||
|
/* 主頁面設計 */
|
||||||
private PictureBox pictureBoxEnglishSongs;
|
private PictureBox pictureBoxEnglishSongs;
|
||||||
|
|
||||||
private Button[] numberButtonsForSongs;
|
private Button[] numberButtonsForSongs;
|
||||||
@ -53,7 +54,7 @@ namespace DualScreenDemo
|
|||||||
var data = LoadConfigData();
|
var data = LoadConfigData();
|
||||||
numberButtonCoords = LoadButtonCoordinates(data, "NumberButtonCoordinates", 10);
|
numberButtonCoords = LoadButtonCoordinates(data, "NumberButtonCoordinates", 10);
|
||||||
var buttonImages = LoadButtonImages(data, "NumberButtonImages", 10);
|
var buttonImages = LoadButtonImages(data, "NumberButtonImages", 10);
|
||||||
|
/* 按鈕圖片路徑設置 */
|
||||||
numberButtonsForSongs = new Button[10];
|
numberButtonsForSongs = new Button[10];
|
||||||
for (int i = 0; i < 10; i++)
|
for (int i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
@ -81,7 +82,7 @@ namespace DualScreenDemo
|
|||||||
this.Controls.Add(numberButtonsForSongs[i]);
|
this.Controls.Add(numberButtonsForSongs[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* 按鈕按下事件 */
|
||||||
private void NumberButtonForSongs_Click(object sender, EventArgs e)
|
private void NumberButtonForSongs_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -95,6 +96,7 @@ namespace DualScreenDemo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 鍵盤對應按鈕位置 */
|
||||||
private void InitializeLetterButtonsForEnglishSongs()
|
private void InitializeLetterButtonsForEnglishSongs()
|
||||||
{
|
{
|
||||||
var data = LoadConfigData();
|
var data = LoadConfigData();
|
||||||
@ -227,7 +229,7 @@ namespace DualScreenDemo
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void InitializeInputBoxEnglishSongs()
|
private void InitializeInputBoxEnglishSongs()
|
||||||
{
|
{ /* 英文輸入介面設定,參考 config.ini */
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var parser = new FileIniDataParser();
|
var parser = new FileIniDataParser();
|
||||||
@ -260,7 +262,7 @@ namespace DualScreenDemo
|
|||||||
};
|
};
|
||||||
|
|
||||||
ResizeAndPositionControl(inputBoxEnglishSongs, x, y, width, height);
|
ResizeAndPositionControl(inputBoxEnglishSongs, x, y, width, height);
|
||||||
|
/*搜尋結果 傳回點歌介面*/
|
||||||
inputBoxEnglishSongs.TextChanged += (sender, e) =>
|
inputBoxEnglishSongs.TextChanged += (sender, e) =>
|
||||||
{
|
{
|
||||||
string searchText = inputBoxEnglishSongs.Text;
|
string searchText = inputBoxEnglishSongs.Text;
|
||||||
@ -280,7 +282,7 @@ namespace DualScreenDemo
|
|||||||
Console.WriteLine($"An error occurred: {ex.Message}");
|
Console.WriteLine($"An error occurred: {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* 圖片位置設置 */
|
||||||
private void ShowImageOnPictureBoxEnglishSongs(string imagePath)
|
private void ShowImageOnPictureBoxEnglishSongs(string imagePath)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -4,6 +4,7 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace DualScreenDemo
|
namespace DualScreenDemo
|
||||||
{
|
{
|
||||||
|
/* 建構子創立,程式進入初始位置,所有搜尋初始化設置 */
|
||||||
public partial class PrimaryForm
|
public partial class PrimaryForm
|
||||||
{
|
{
|
||||||
private Button zhuyinSearchSongButton;
|
private Button zhuyinSearchSongButton;
|
||||||
|
Reference in New Issue
Block a user