From f97501c1af2d57ab9b849c192fef78154f5b195c Mon Sep 17 00:00:00 2001 From: "allen.yan" Date: Wed, 6 Aug 2025 18:02:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=96=E7=89=87=E4=BE=86=E6=BA=90=E8=B7=AF?= =?UTF-8?q?=E5=BE=91=E8=87=AA=E6=9C=AC=E5=9C=B0=E7=A7=BB=E8=87=B3=E7=B7=9A?= =?UTF-8?q?=E4=B8=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PrimaryFormParts/PrimaryForm.Favorite.cs | 18 +++-- .../PrimaryForm.MultiPagePanel.cs | 23 +++++- PrimaryFormParts/PrimaryForm.Promotions.cs | 8 +- PrimaryFormParts/PrimaryForm.QRCode.cs | 7 +- PrimaryFormParts/PrimaryForm.SoundEffects.cs | 40 +++++----- PrimaryFormParts/PrimaryForm.SyncScreen.cs | 74 +++++++++--------- PrimaryFormParts/PrimaryForm.ToggleLight.cs | 67 ++++++++-------- PrimaryFormParts/PrimaryForm.VodScreen.cs | 76 ++++++++----------- .../PrimaryForm.SongSearch.NumberSearch.cs | 50 ++++-------- 9 files changed, 178 insertions(+), 185 deletions(-) diff --git a/PrimaryFormParts/PrimaryForm.Favorite.cs b/PrimaryFormParts/PrimaryForm.Favorite.cs index 6d67cc3..3e2e4f0 100644 --- a/PrimaryFormParts/PrimaryForm.Favorite.cs +++ b/PrimaryFormParts/PrimaryForm.Favorite.cs @@ -45,6 +45,8 @@ namespace DualScreenDemo favoriteNumberButton = new Button[10]; + var data=LoadConfigData(); + for (int i = 0; i < favoriteNumberButton.Length; i++) { favoriteNumberButton[i] = new Button(); @@ -53,7 +55,7 @@ namespace DualScreenDemo string fileName = (i+1).ToString(); - string filePath = Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\我的最愛_" + fileName + ".png"); + string filePath = Path.Combine(data["ImageSrc"]["path"], @"themes\superstar\button\3.介面\我的最愛_" + fileName + ".png"); favoriteNumberButton[i].BackgroundImage = Image.FromFile(filePath); favoriteNumberButton[i].BackgroundImageLayout = ImageLayout.Stretch; favoriteNumberButton[i].FlatStyle = FlatStyle.Flat; @@ -85,7 +87,7 @@ namespace DualScreenDemo Name = "enterFavoriteButton" }; ResizeAndPositionButton(enterFavoriteButton, 832, 657, 70, 65); - enterFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\我的最愛_確認.png")); + enterFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(data["ImageSrc"]["path"], @"themes\superstar\button\3.介面\我的最愛_確認.png")); enterFavoriteButton.BackgroundImageLayout = ImageLayout.Stretch; enterFavoriteButton.FlatStyle = FlatStyle.Flat; enterFavoriteButton.FlatAppearance.BorderSize = 0; @@ -100,7 +102,7 @@ namespace DualScreenDemo Name = "newFavoriteButton" }; ResizeAndPositionButton(newFavoriteButton, 916, 657, 70, 65); - newFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\我的最愛_新建.png")); + newFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(data["ImageSrc"]["path"], @"themes\superstar\button\3.介面\我的最愛_新建.png")); newFavoriteButton.BackgroundImageLayout = ImageLayout.Stretch; newFavoriteButton.FlatStyle = FlatStyle.Flat; newFavoriteButton.FlatAppearance.BorderSize = 0; @@ -115,7 +117,7 @@ namespace DualScreenDemo Name = "refillFavoriteButton" }; ResizeAndPositionButton(refillFavoriteButton, 999, 657, 70, 65); - refillFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\我的最愛_重填.png")); + refillFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(data["ImageSrc"]["path"], @"themes\superstar\button\3.介面\我的最愛_重填.png")); refillFavoriteButton.BackgroundImageLayout = ImageLayout.Stretch; refillFavoriteButton.FlatStyle = FlatStyle.Flat; refillFavoriteButton.FlatAppearance.BorderSize = 0; @@ -130,7 +132,7 @@ namespace DualScreenDemo Name = "closeFavoriteButton" }; ResizeAndPositionButton(closeFavoriteButton, 1083, 657, 70, 65); - closeFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\我的最愛_關閉.png")); + closeFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(data["ImageSrc"]["path"], @"themes\superstar\button\3.介面\我的最愛_關閉.png")); closeFavoriteButton.BackgroundImageLayout = ImageLayout.Stretch; closeFavoriteButton.FlatStyle = FlatStyle.Flat; closeFavoriteButton.FlatAppearance.BorderSize = 0; @@ -329,6 +331,8 @@ namespace DualScreenDemo private void MyFavoritesButton_Click(object sender, EventArgs e) { + var data = LoadConfigData(); + newSongAlertButton.BackgroundImage = newSongAlertNormalBackground; hotPlayButton.BackgroundImage = hotPlayNormalBackground; singerSearchButton.BackgroundImage = singerSearchNormalBackground; @@ -337,7 +341,7 @@ namespace DualScreenDemo groupSearchButton.BackgroundImage = groupSearchNormalBackground; categorySearchButton.BackgroundImage = categorySearchNormalBackground; orderedSongsButton.BackgroundImage = orderedSongsNormalBackground; - myFavoritesButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_我的最愛(已按).png")); + myFavoritesButton.BackgroundImage = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別上方_我的最愛(已按).png")); promotionsButton.BackgroundImage = promotionsNormalBackground; deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground; isOnOrderedSongsPage = false; @@ -346,7 +350,7 @@ namespace DualScreenDemo if (!FavoritePictureBox.Visible) { - ShowImageOnFavoritePictureBox(Path.Combine(Application.StartupPath, @"themes\superstar\我的最愛\我的最愛_工作區域.jpg")); + ShowImageOnFavoritePictureBox(Path.Combine(data["ImageSrc"]["path"], @"themes\superstar\我的最愛\我的最愛_工作區域.jpg")); SetFavoritePictureBoxAndButtonsVisibility(true); } else diff --git a/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs b/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs index 42a99ec..f8bd453 100644 --- a/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs +++ b/PrimaryFormParts/PrimaryForm.MultiPagePanel.cs @@ -1,5 +1,8 @@ using DBObj; +using IniParser.Model; +using IniParser; using System.IO; +using System.Text; namespace DualScreenDemo { @@ -420,12 +423,15 @@ namespace DualScreenDemo int songWidth = (int)(this.Width * SongWidth); int artistWidth = (int)(this.Width * ArtistWidth); int artistX = songX + songWidth + 10; + + var data = LoadConfigData(); + // 添加人聲標籤 if (song.getHumanVoice() == 1) { PictureBox icon = new PictureBox() { - Image = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\其他符號_人聲.png")), + Image = Image.FromFile(Path.Combine(data["ImageSrc"]["path"], @"themes\superstar\button\3.介面\其他符號_人聲.png")), SizeMode = PictureBoxSizeMode.Zoom, Size = new Size(30, 30), Location = new Point(songX + 5, y + 8) @@ -511,8 +517,19 @@ namespace DualScreenDemo artistLabel.BringToFront(); songLabel.TextAlign = ContentAlignment.TopLeft; } - - + + private IniData LoadConfigData() + { + var parser = new FileIniDataParser(); + string iniFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.ini"); + + + // 使用 UTF-8 讀取 INI 檔案並解析內容 + using (var reader = new StreamReader(iniFilePath, Encoding.UTF8)) + { + return parser.ReadData(reader); + } + } } } } diff --git a/PrimaryFormParts/PrimaryForm.Promotions.cs b/PrimaryFormParts/PrimaryForm.Promotions.cs index 5765a41..bcae8b7 100644 --- a/PrimaryFormParts/PrimaryForm.Promotions.cs +++ b/PrimaryFormParts/PrimaryForm.Promotions.cs @@ -19,6 +19,8 @@ namespace DualScreenDemo int baseY = Screen.PrimaryScreen.Bounds.Height - 120; int buttonSpacing = 90; + var data = LoadConfigData(); + // 共用的按鈕設置 void ConfigurePromotionButton(Button button, string imagePath, Point location) { @@ -30,7 +32,7 @@ namespace DualScreenDemo button.FlatAppearance.MouseDownBackColor = Color.Transparent; button.Location = location; - using (var stream = new MemoryStream(File.ReadAllBytes(Path.Combine(Application.StartupPath, imagePath)))) + using (var stream = new MemoryStream(File.ReadAllBytes(Path.Combine(data["ImageSrc"]["path"], imagePath)))) { var image = Image.FromStream(stream); if (image.PixelFormat != System.Drawing.Imaging.PixelFormat.Format32bppArgb) @@ -78,6 +80,8 @@ namespace DualScreenDemo private void promotionsButton_Click(object sender, EventArgs e) { + var data = LoadConfigData(); + promotionsAndMenuPanel.currentPageIndex=0; newSongAlertButton.BackgroundImage = newSongAlertNormalBackground; hotPlayButton.BackgroundImage = hotPlayNormalBackground; @@ -88,7 +92,7 @@ namespace DualScreenDemo categorySearchButton.BackgroundImage = categorySearchNormalBackground; orderedSongsButton.BackgroundImage = orderedSongsNormalBackground; myFavoritesButton.BackgroundImage = myFavoritesNormalBackground; - promotionsButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_優惠活動(已按).png")); + promotionsButton.BackgroundImage = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別上方_優惠活動(已按).png")); deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground; isOnOrderedSongsPage = false; diff --git a/PrimaryFormParts/PrimaryForm.QRCode.cs b/PrimaryFormParts/PrimaryForm.QRCode.cs index b39a014..846752c 100644 --- a/PrimaryFormParts/PrimaryForm.QRCode.cs +++ b/PrimaryFormParts/PrimaryForm.QRCode.cs @@ -8,10 +8,13 @@ namespace DualScreenDemo public void OverlayQRCodeOnImage(string randomFolderPath) { + + var data = LoadConfigData(); + try { - string imagePath = Path.Combine(Application.StartupPath, "themes/superstar/button/3.介面/手機點歌QR碼_完整介面.png"); + string imagePath = Path.Combine(data["ImageSrc"]["path"], "themes/superstar/button/3.介面/手機點歌QR碼_完整介面.png"); if (!File.Exists(imagePath)) { Console.WriteLine("Base image not found: " + imagePath); @@ -79,7 +82,7 @@ namespace DualScreenDemo ResizeAndPositionControl(pictureBoxQRCode, 975, 442, 226, 274); - Bitmap originalImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\手機點歌QR碼_完整介面.png")); + Bitmap originalImage = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\手機點歌QR碼_完整介面.png")); //Rectangle closeQRCodeCropArea = new Rectangle(198, 6, 22, 22); diff --git a/PrimaryFormParts/PrimaryForm.SoundEffects.cs b/PrimaryFormParts/PrimaryForm.SoundEffects.cs index bb35026..db15b16 100644 --- a/PrimaryFormParts/PrimaryForm.SoundEffects.cs +++ b/PrimaryFormParts/PrimaryForm.SoundEffects.cs @@ -24,15 +24,16 @@ namespace DualScreenDemo private void InitializeSoundEffectButtons() { + var data = LoadConfigData(); constructionButton = new Button { Name = "constructionButton", }; ConfigureButton(constructionButton, 876, 494, 148, 64, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_ua.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_ua.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_ua.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_ua.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_ua.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_ua.png")), ConstructionButton_Click); this.Controls.Add(constructionButton); @@ -42,9 +43,9 @@ namespace DualScreenDemo Name = "marketButton", }; ConfigureButton(marketButton, 1037, 495, 148, 63, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_.png")), MarketButton_Click); this.Controls.Add(marketButton); @@ -54,9 +55,9 @@ namespace DualScreenDemo Name = "drivingButton", }; ConfigureButton(drivingButton, 876, 570, 148, 63, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_}.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_}.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_}.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_}.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_}.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_}.png")), DrivingButton_Click); this.Controls.Add(drivingButton); @@ -66,9 +67,9 @@ namespace DualScreenDemo Name = "airportButton", }; ConfigureButton(airportButton, 1037, 570, 148, 63, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_.png")), AirportButton_Click); this.Controls.Add(airportButton); @@ -78,9 +79,9 @@ namespace DualScreenDemo Name = "officeButton", }; ConfigureButton(officeButton, 876, 646, 148, 64, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_줽.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_줽.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_줽.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_줽.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_줽.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_줽.png")), OfficeButton_Click); this.Controls.Add(officeButton); @@ -91,15 +92,16 @@ namespace DualScreenDemo }; ConfigureButton(closeButton, 1036, 646, 150, 63, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.\\_.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.\\_.png")), CloseButton_Click); this.Controls.Add(closeButton); } private void SoundEffectButton_Click(object sender, EventArgs e) { + var data = LoadConfigData(); SetHotSongButtonsVisibility(false); SetNewSongButtonsVisibility(false); @@ -108,7 +110,7 @@ namespace DualScreenDemo if (!pictureBoxSceneSoundEffects.Visible) { - ShowImageOnPictureBoxSceneSoundEffects(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.\_ťդ.png")); + ShowImageOnPictureBoxSceneSoundEffects(Path.Combine(data["ImageSrc"]["path"], @"themes\superstar\button\3.\_ťդ.png")); SetPictureBoxSceneSoundEffectsAndButtonsVisibility(true); } else diff --git a/PrimaryFormParts/PrimaryForm.SyncScreen.cs b/PrimaryFormParts/PrimaryForm.SyncScreen.cs index ef34c48..8c9f3fc 100644 --- a/PrimaryFormParts/PrimaryForm.SyncScreen.cs +++ b/PrimaryFormParts/PrimaryForm.SyncScreen.cs @@ -40,72 +40,74 @@ namespace DualScreenDemo this.primaryScreenPanel.BorderStyle = BorderStyle.FixedSingle; this.primaryScreenPanel.BackColor = System.Drawing.Color.Black; + var data=LoadConfigData(); + // 同步畫面 服務鈴 ConfigureButton(this.syncServiceBellButton, 1240, 17, 161, 161, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_服務鈴.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_服務鈴.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_服務鈴.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_服務鈴.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_服務鈴.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_服務鈴.png")), //(sender, e) => SendCommandThroughSerialPort("a2 53 a4")); (sender,e)=>OnServiceBellButtonClick(sender,e)); ConfigureButton(this.syncCutSongButton, 1218, 195, 205, 56, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_切歌.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_切歌.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_切歌.png")), (sender, e) => videoPlayerForm.PlayNextSong()); + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_切歌.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_切歌.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_切歌.png")), (sender, e) => videoPlayerForm.PlayNextSong()); ConfigureButton(this.syncReplayButton, 1218, 265, 205, 56, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_重唱.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_重唱.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_重唱.png")), ReplayButton_Click); + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_重唱.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_重唱.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_重唱.png")), ReplayButton_Click); // 有人聲入口位置 ConfigureButton(this.syncOriginalSongButton, 1218, 335, 205, 56, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_原唱.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_原唱.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_原唱.png")), (sender,e) => videoPlayerForm.ToggleVocalRemoval()); + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_原唱.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_原唱.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_原唱.png")), (sender,e) => videoPlayerForm.ToggleVocalRemoval()); ConfigureButton(this.syncMuteButton, 1218, 406, 205, 55, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_靜音.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_靜音.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_靜音.png")), MuteUnmuteButton_Click); + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_靜音.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_靜音.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_靜音.png")), MuteUnmuteButton_Click); ConfigureButton(this.syncPauseButton, 1218, 475, 205, 56, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), SyncPauseButton_Click); + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), SyncPauseButton_Click); ConfigureButton(this.syncPlayButton, 1218, 475, 205, 56, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), SyncPlayButton_Click); + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_暫停.png")), SyncPlayButton_Click); ConfigureButton(this.syncVolumeUpButton, 1218, 546, 205, 55, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_音樂+.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_音樂+.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_音樂+.png")), null); + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_音樂+.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_音樂+.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_音樂+.png")), null); this.syncVolumeUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↑ ","a2 b3 a4"); }; this.syncVolumeUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); }; ConfigureButton(this.syncVolumeDownButton, 1218, 616, 205, 55, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_音樂-.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_音樂-.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_音樂-.png")), null); + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_音樂-.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_音樂-.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_音樂-.png")), null); this.syncVolumeDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↓ ","a2 b4 a4");}; this.syncVolumeDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel();}; ConfigureButton(this.syncMicUpButton, 1218, 686, 205, 56, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_麥克風+.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_麥克風+.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_麥克風+.png")), null); + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_麥克風+.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_麥克風+.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_麥克風+.png")), null); this.syncMicUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↑ ","a2 b5 a4");}; this.syncMicUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); }; ConfigureButton(this.syncMicDownButton, 1218, 756, 205, 56, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_麥克風-.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_麥克風-.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_麥克風-.png")), null); + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_麥克風-.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_麥克風-.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_麥克風-.png")), null); this.syncMicDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↓ ","a2 b6 a4");}; this.syncMicDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); }; @@ -114,9 +116,9 @@ namespace DualScreenDemo ConfigureButton(this.syncCloseButton, 1218, 826, 205, 56, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_關閉.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_關閉.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\同步畫面_關閉.png")), SyncCloseButton_Click); + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_關閉.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_關閉.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\同步畫面_關閉.png")), SyncCloseButton_Click); diff --git a/PrimaryFormParts/PrimaryForm.ToggleLight.cs b/PrimaryFormParts/PrimaryForm.ToggleLight.cs index dd3df84..adcce46 100644 --- a/PrimaryFormParts/PrimaryForm.ToggleLight.cs +++ b/PrimaryFormParts/PrimaryForm.ToggleLight.cs @@ -30,12 +30,13 @@ namespace DualScreenDemo private void InitializeButtonsForPictureBoxToggleLight() { + var data=LoadConfigData(); btnTurnOn = new Button { Text = "" }; ConfigureButton(btnTurnOn, 29, 45, 250, 67, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_ON-OFF.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_ON-OFF.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_ON-OFF.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_ON-OFF.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_ON-OFF.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_ON-OFF.png")), null); @@ -71,9 +72,9 @@ namespace DualScreenDemo btnBright = new Button{ Text = "" }; ConfigureButton(btnBright, 295, 45, 118, 65, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_明亮.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_明亮.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_明亮.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_明亮.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_明亮.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_明亮.png")), null); btnBright.Click += (sender, e) => { @@ -95,74 +96,74 @@ namespace DualScreenDemo btnRomantic = new Button{ Text = "" }; ConfigureButton(btnRomantic, 430, 45, 118, 65, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_浪漫.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_浪漫.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_浪漫.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_浪漫.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_浪漫.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_浪漫.png")), (sender, e) => SendCommandThroughSerialPort("a2 d7 a4")); btnAuto = new Button{ Text = "" }; ConfigureButton(btnAuto, 430, 125, 118, 65, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_自動.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_自動.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_自動.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_自動.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_自動.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_自動.png")), null); btnColorTuning = new Button{ Text = "" }; ConfigureButton(btnColorTuning, 430, 203, 118, 65, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_調色.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_調色.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_調色.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_調色.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_調色.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_調色.png")), (sender, e) => SendCommandThroughSerialPort("a2 75 a4")); btnSoft = new Button{ Text = "" }; ConfigureButton(btnSoft, 295, 125, 118, 65, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_柔和.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_柔和.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_柔和.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_柔和.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_柔和.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_柔和.png")), (sender, e) => SendCommandThroughSerialPort("a2 d6 a4")); btnDynamic = new Button{ Text = "" }; ConfigureButton(btnDynamic, 295, 203, 118, 65, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_動感.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_動感.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_動感.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_動感.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_動感.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_動感.png")), (sender, e) => SendCommandThroughSerialPort("a2 d8 a4")); btnDeskLamp = new Button{ Text = "" }; ConfigureButton(btnDeskLamp, 430, 283, 118, 65, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_桌燈.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_桌燈.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_桌燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_桌燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_桌燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_桌燈.png")), (sender, e) => SendCommandThroughSerialPort("a2 fb a4")); btnStageLight = new Button{ Text = "" }; ConfigureButton(btnStageLight, 295, 283, 118, 65, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_舞台燈.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_舞台燈.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_舞台燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_舞台燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_舞台燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_舞台燈.png")), (sender, e) => SendCommandThroughSerialPort("a2 fa a4")); btnShelfLight = new Button{ Text = "" }; ConfigureButton(btnShelfLight, 163, 283, 118, 65, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_層板燈.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_層板燈.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_層板燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_層板燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_層板燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_層板燈.png")), (sender, e) => SendCommandThroughSerialPort("a2 f9 a4")); btnWallLight = new Button{ Text = "" }; ConfigureButton(btnWallLight, 29, 283, 118, 65, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_壁燈.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_壁燈.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\3.介面\\燈光控制_壁燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_壁燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_壁燈.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\燈光控制_壁燈.png")), (sender, e) => SendCommandThroughSerialPort("a2 f8 a4")); diff --git a/PrimaryFormParts/PrimaryForm.VodScreen.cs b/PrimaryFormParts/PrimaryForm.VodScreen.cs index 6ba4f1b..d4fabe3 100644 --- a/PrimaryFormParts/PrimaryForm.VodScreen.cs +++ b/PrimaryFormParts/PrimaryForm.VodScreen.cs @@ -22,59 +22,49 @@ namespace DualScreenDemo int xPosition = (screenWidth - pictureBoxWidth) / 2; int yPosition = (screenHeight - pictureBoxHeight) / 2; + var data=LoadConfigData(); vodButton = new Button(); vodButton.Text = ""; - ResizeAndPositionButton(vodButton, xPosition - 119, yPosition + 35, 110, 50); - vodButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\歌曲點播_點播.png")); - vodButton.BackgroundImageLayout = ImageLayout.Stretch; - vodButton.FlatStyle = FlatStyle.Flat; - vodButton.FlatAppearance.BorderSize = 0; - vodButton.BackColor = Color.Transparent; - vodButton.FlatAppearance.MouseDownBackColor = Color.Transparent; - vodButton.FlatAppearance.MouseOverBackColor = Color.Transparent; - vodButton.Click += VodButton_Click; + ConfigureButton(vodButton, xPosition - 119, yPosition + 35, 110, 50, + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_點播.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_點播.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_點播.png")), + VodButton_Click); + vodButton.Visible = false; insertButton = new Button(); insertButton.Text = ""; - ResizeAndPositionButton(insertButton, xPosition + 12 , yPosition + 35, 110, 50); - insertButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\歌曲點播_插播.png")); - insertButton.BackgroundImageLayout = ImageLayout.Stretch; - insertButton.FlatStyle = FlatStyle.Flat; - insertButton.FlatAppearance.BorderSize = 0; - insertButton.BackColor = Color.Transparent; - insertButton.FlatAppearance.MouseDownBackColor = Color.Transparent; - insertButton.FlatAppearance.MouseOverBackColor = Color.Transparent; - insertButton.Click += InsertButton_Click; + ConfigureButton(insertButton, xPosition + 12, yPosition + 35, 110, 50, + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_插播.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_插播.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_插播.png")), + InsertButton_Click); + insertButton.Visible = false; albumButton = new Button(); albumButton.Text = ""; - ResizeAndPositionButton(albumButton, xPosition + 142, yPosition + 35, 140, 50); - albumButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\歌曲點播_歷年專輯.png")); - albumButton.BackgroundImageLayout = ImageLayout.Stretch; - albumButton.FlatStyle = FlatStyle.Flat; - albumButton.FlatAppearance.BorderSize = 0; - albumButton.BackColor = Color.Transparent; - albumButton.FlatAppearance.MouseDownBackColor = Color.Transparent; - albumButton.FlatAppearance.MouseOverBackColor = Color.Transparent; - albumButton.Click += AlbumButton_Click; + ConfigureButton(albumButton, xPosition + 142, yPosition + 35, 140, 50, + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_歷年專輯.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_歷年專輯.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_歷年專輯.png")), + AlbumButton_Click); + albumButton.Visible = false; favoriteButton = new Button(); favoriteButton.Text = ""; - ResizeAndPositionButton(favoriteButton, xPosition + 302, yPosition + 35, 140, 50); - favoriteButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\歌曲點播_我的最愛.png")); - favoriteButton.BackgroundImageLayout = ImageLayout.Stretch; - favoriteButton.FlatStyle = FlatStyle.Flat; - favoriteButton.FlatAppearance.BorderSize = 0; - favoriteButton.BackColor = Color.Transparent; - favoriteButton.FlatAppearance.MouseDownBackColor = Color.Transparent; - favoriteButton.FlatAppearance.MouseOverBackColor = Color.Transparent; + ConfigureButton(favoriteButton, xPosition + 302, yPosition + 35, 140, 50, + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_我的最愛.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_我的最愛.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_我的最愛.png")), + FavoriteButton_Click); + disabledPanel = new Panel(); disabledPanel.BackColor = Color.FromArgb(128, Color.Black); @@ -84,7 +74,6 @@ namespace DualScreenDemo favoriteButton.Controls.Add(disabledPanel); - favoriteButton.Click += FavoriteButton_Click; if (!isLoggedIn) { @@ -96,16 +85,11 @@ namespace DualScreenDemo vodScreenCloseButton = new Button(); vodScreenCloseButton.Text = ""; - ResizeAndPositionButton(vodScreenCloseButton, xPosition + 462, yPosition + 35, 110, 50); - vodScreenCloseButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\歌曲點播_關閉.png")); - vodScreenCloseButton.BackgroundImageLayout = ImageLayout.Stretch; - vodScreenCloseButton.FlatStyle = FlatStyle.Flat; - vodScreenCloseButton.FlatAppearance.BorderSize = 0; - vodScreenCloseButton.BackColor = Color.Transparent; - vodScreenCloseButton.FlatAppearance.MouseDownBackColor = Color.Transparent; - vodScreenCloseButton.FlatAppearance.MouseOverBackColor = Color.Transparent; - vodScreenCloseButton.Click += VodScreenCloseButton_Click; - vodScreenCloseButton.Visible = false; + ConfigureButton(vodScreenCloseButton, xPosition + 462, yPosition + 35, 110, 50, + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_關閉.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_關閉.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\3.介面\\歌曲點播_關閉.png")), + VodScreenCloseButton_Click); this.Controls.Add(vodButton); diff --git a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.NumberSearch.cs b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.NumberSearch.cs index a34789f..8a0e2e1 100644 --- a/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.NumberSearch.cs +++ b/PrimaryFormParts/SongSearch/PrimaryForm.SongSearch.NumberSearch.cs @@ -4,7 +4,7 @@ using IniParser; using IniParser.Model; using System.Text; using DBObj; -using System; + /* WordCountSongs -> SongIDSearch @@ -71,13 +71,13 @@ namespace DualScreenDemo numberSearchSongButton.BackgroundImage = numberSearchSongActiveBackground; // 載入設定檔,取得圖片路徑資訊 - var configData = LoadConfigDataforSongIDSearch(); + var configData = LoadConfigData(); // 取得「注音歌手圖片」的完整路徑 - string imagePath = Path.Combine(Application.StartupPath, configData["ImagePaths"]["SongIDSearch"]); + string imagePath = Path.Combine(configData["ImageSrc"]["path"], configData["ImagePaths"]["SongIDSearch"]); // 在 PictureBox 中顯示對應的「注音歌手」圖片 - ShowImageOnPictureBoxSongIDSearch(Path.Combine(Application.StartupPath, imagePath)); + ShowImageOnPictureBoxSongIDSearch(Path.Combine(configData["ImageSrc"]["path"], imagePath)); // 鍵盤UI介面顯示設定 SetWordCountSongsAndButtonsVisibility(false); @@ -106,41 +106,17 @@ namespace DualScreenDemo // 設定檔路徑 string iniFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.ini"); - - IniData data; - - // 以 UTF-8 編碼開啟並讀取 INI 檔案 - using (var reader = new StreamReader(iniFilePath, Encoding.UTF8)) - { - // 解析 INI 檔內容 - data = parser.ReadData(reader); - } + // 載入設定檔,取得圖片路徑資訊 + var configData = LoadConfigData(); // 取得 [NumberSongIDSymbols] 區塊中的 "Symbols" 欄位內容 - string symbols = data["NumberSongIDSymbols"]["Symbols"]; + string symbols = configData["NumberSongIDSymbols"]["Symbols"]; // 將符號字串以逗號分隔,轉換為字串陣列 numberSongIDSymbols = symbols.Split(','); } - - /// - /// 從設定檔 (config.ini) 載入 INI 設定數據。 - /// - /// 回傳解析後的 INI 設定數據 (IniData)。 - private IniData LoadConfigDataforSongIDSearch() - { - var parser = new FileIniDataParser(); - string iniFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.ini"); - - - // 使用 UTF-8 讀取 INI 檔案並解析內容 - using (var reader = new StreamReader(iniFilePath, Encoding.UTF8)) - { - return parser.ReadData(reader); - } - } - + /// /// 從 INI 設定數據中讀取注音符號 (NumberSongID Symbols)。 /// @@ -253,7 +229,7 @@ namespace DualScreenDemo private void InitializeNumberSongIDButtons() { // 載入配置資料 - var data = LoadConfigDataforSongIDSearch(); + var data = LoadConfigData(); // 載入語音符號(如拼音、注音符號等) numberSongIDSymbols = LoadNumberSongIDSymbols(data); @@ -429,7 +405,7 @@ namespace DualScreenDemo private void InitializeModifyButtonSongIDSearch() { // 加載配置數據 - var data = LoadConfigDataforSongIDSearch(); + var data = LoadConfigData(); // 讀取按鈕坐標 modifyButtonSongIDCoords = LoadSpecialButtonCoordinatesForSongIDSearch(data, "SpecialButtonCoordinates", "modifyButtonSongIDSearch"); @@ -469,7 +445,7 @@ namespace DualScreenDemo private void InitializeClearButtonSongIDSearch() { // 加載配置數據 - var data = LoadConfigDataforSongIDSearch(); + var data = LoadConfigData(); // 讀取按鈕坐標 clearButtonSongIDCoords = LoadSpecialButtonCoordinatesForSongIDSearch(data, "SpecialButtonCoordinates", "clearButtonSongIDSearch"); @@ -491,7 +467,7 @@ namespace DualScreenDemo private void InitializeEnterButtonSongIDSearch() { // 加載配置數據 - var data = LoadConfigDataforSongIDSearch(); + var data = LoadConfigData(); // 讀取按鈕坐標 enterButtonSongIDCoords = LoadSpecialButtonCoordinatesForSongIDSearch(data, "SpecialButtonCoordinates", "enterButtonSongIDSearch"); @@ -531,7 +507,7 @@ namespace DualScreenDemo private void InitializeCloseButtonSongIDSearch() { // 加載配置數據 - var data = LoadConfigDataforSongIDSearch(); + var data = LoadConfigData(); // 讀取按鈕坐標 closeButtonSongIDCoords = LoadSpecialButtonCoordinatesForSongIDSearch(data, "SpecialButtonCoordinates", "closeButtonSongIDSearch");