superstar_v2/PrimaryFormParts/PrimaryForm.SyncScreen.cs

176 lines
9.1 KiB
C#
Raw Normal View History

2025-04-07 16:54:10 +08:00
using OverlayFormObj;
2025-08-06 10:47:43 +08:00
using System.IO;
2025-04-07 16:54:10 +08:00
namespace DualScreenDemo
{
public partial class PrimaryForm : Form
{
public Panel primaryScreenPanel;
public Panel videoPanel;
2025-04-07 16:54:10 +08:00
public Button syncServiceBellButton;
public Button syncCutSongButton;
public Button syncReplayButton;
public Button syncOriginalSongButton;
public Button syncMuteButton;
public Button syncPauseButton;
public Button syncPlayButton;
public Button syncVolumeUpButton;
public Button syncVolumeDownButton;
public Button syncMicUpButton;
public Button syncMicDownButton;
public Button syncCloseButton;
private void InitializeSyncScreen()
{
this.primaryScreenPanel = new System.Windows.Forms.Panel();
this.videoPanel = new System.Windows.Forms.Panel();
2025-04-07 16:54:10 +08:00
this.syncServiceBellButton = new System.Windows.Forms.Button();
this.syncCutSongButton = new System.Windows.Forms.Button();
this.syncReplayButton = new System.Windows.Forms.Button();
this.syncOriginalSongButton = new System.Windows.Forms.Button();
this.syncMuteButton = new System.Windows.Forms.Button();
this.syncPauseButton = new System.Windows.Forms.Button();
this.syncPlayButton = new System.Windows.Forms.Button();
this.syncVolumeUpButton = new System.Windows.Forms.Button();
this.syncVolumeDownButton = new System.Windows.Forms.Button();
this.syncMicUpButton = new System.Windows.Forms.Button();
this.syncMicDownButton = new System.Windows.Forms.Button();
this.syncCloseButton = new System.Windows.Forms.Button();
this.SuspendLayout();
ResizeAndPositionControl(this.primaryScreenPanel, 0, 0, 1440, 900);
this.primaryScreenPanel.TabIndex = 0;
this.primaryScreenPanel.BorderStyle = BorderStyle.None;
2025-04-07 16:54:10 +08:00
this.primaryScreenPanel.BackColor = System.Drawing.Color.Black;
ResizeAndPositionControl(this.videoPanel, 0, 0, 1200, 900);
this.videoPanel.TabIndex = 0;
this.videoPanel.BorderStyle = BorderStyle.None;
this.videoPanel.BackColor = System.Drawing.Color.Black;
var data=LoadBtnConfigData();
// 同步畫面 服務鈴
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncServiceBellButton, 1240, 17, 161, 161,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["ServiceBell"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["ServiceBell"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["ServiceBell"])),
//(sender, e) => SendCommandThroughSerialPort("a2 53 a4"));
(sender,e)=>OnServiceBellButtonClick(sender,e));
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncCutSongButton, 1218, 195, 205, 56,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["CutSong"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["CutSong"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["CutSong"])), (sender, e) => videoPlayerForm.PlayNextSong());
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncReplayButton, 1218, 265, 205, 56,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Replay"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Replay"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Replay"])), ReplayButton_Click);
2025-06-18 13:43:35 +08:00
// 有人聲入口位置
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncOriginalSongButton, 1218, 335, 205, 56,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Original"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Original"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Original"])), (sender,e) => videoPlayerForm.ToggleVocalRemoval());
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncMuteButton, 1218, 406, 205, 55,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Mute"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Mute"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Mute"])), MuteUnmuteButton_Click);
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncPauseButton, 1218, 475, 205, 56,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Stop"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Stop"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Stop"])), SyncPauseButton_Click);
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncPlayButton, 1218, 475, 205, 56,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Play"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Play"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Play"])), SyncPlayButton_Click);
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncVolumeUpButton, 1218, 546, 205, 55,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolGain"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolGain"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolGain"])), null);
2025-08-06 10:47:43 +08:00
this.syncVolumeUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↑ ","a2 b3 a4"); };
this.syncVolumeUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncVolumeDownButton, 1218, 616, 205, 55,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])), null);
2025-08-06 10:47:43 +08:00
this.syncVolumeDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↓ ","a2 b4 a4");};
this.syncVolumeDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel();};
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncMicUpButton, 1218, 686, 205, 56,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])), null);
2025-08-06 10:47:43 +08:00
this.syncMicUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↑ ","a2 b5 a4");};
this.syncMicUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncMicDownButton, 1218, 756, 205, 56,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])), null);
2025-08-06 10:47:43 +08:00
this.syncMicDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↓ ","a2 b6 a4");};
this.syncMicDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
2025-04-07 16:54:10 +08:00
2025-08-06 10:47:43 +08:00
ConfigureButton(this.syncCloseButton, 1218, 826, 205, 56,
2025-08-13 16:42:22 +08:00
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Close"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Close"])),
new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Close"])), SyncCloseButton_Click);
2025-04-07 16:54:10 +08:00
this.ClientSize = new System.Drawing.Size(1440, 900);
this.Controls.Add(this.primaryScreenPanel);
this.primaryScreenPanel.Controls.Add(this.videoPanel);
videoPanel.Controls.Add(videoView0);
2025-04-07 16:54:10 +08:00
this.Controls.Add(this.syncCloseButton);
this.Name = "PrimaryForm";
this.ResumeLayout(false);
}
private void SyncPauseButton_Click(object sender, EventArgs e)
{
videoPlayerForm.Pause();
syncPauseButton.Visible = false;
syncPlayButton.Visible = true;
syncPlayButton.BringToFront();
pauseButton.Visible = false;
playButton.Visible = true;
}
private void SyncPlayButton_Click(object sender, EventArgs e)
{
videoPlayerForm.Play();
syncPauseButton.Visible = true;
syncPauseButton.BringToFront();
syncPlayButton.Visible = false;
pauseButton.Visible = true;
playButton.Visible = false;
}
private void SyncCloseButton_Click(object sender, EventArgs e)
{
VideoPlayerForm.Instance.ClosePrimaryScreenPanel();
}
private void SyncScreenButton_Click(object sender, EventArgs e)
{
videoPlayerForm.IsSyncToPrimaryMonitor = true;
videoPlayerForm.SyncToPrimaryMonitor();
}
}
}