打包時必要更改檢查項目

This commit is contained in:
jasonchenwork 2025-06-24 10:58:05 +08:00
parent dd2a0f3d7b
commit 107639f4c9
3 changed files with 81 additions and 28 deletions

View File

@ -10,7 +10,7 @@ namespace DataCheck
} }
private void menu_check() private void menu_check()
{ {
string menuPath = @"\\SVR01\foods"; string menuPath = @"\\JLDKTV\foods";
string menuPath_local = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "foods"); string menuPath_local = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "foods");
if (!Directory.Exists(menuPath_local)) if (!Directory.Exists(menuPath_local))
@ -73,7 +73,7 @@ namespace DataCheck
} }
private void news_check() private void news_check()
{ {
string newsPath = @"\\SVR01\news"; string newsPath = @"\\JLDKTV\news";
string newsPath_local = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "news"); string newsPath_local = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "news");
if (!Directory.Exists(newsPath_local)) if (!Directory.Exists(newsPath_local))

View File

@ -40,9 +40,10 @@ namespace DualScreenDemo
string randomFolderName = CreateRandomFolderAndRedirectHTML(baseDirectory); string randomFolderName = CreateRandomFolderAndRedirectHTML(baseDirectory);
randomFolderPath = randomFolderName; randomFolderPath = randomFolderName;
// 安裝包更新
string localAddress = GetLocalIPAddress(); string localAddress = GetLocalIPAddress();
string externalAddress = File.Exists(@"\\svr01\txt\ip.txt") string externalAddress = File.Exists(@"\\JLDKTV\txt\ip.txt")
? File.ReadAllText(@"\\svr01\txt\ip.txt").Trim() ? File.ReadAllText(@"\\JLDKTV\txt\ip.txt").Trim()
: ""; : "";
_listener = new HttpListener(); _listener = new HttpListener();
@ -427,36 +428,50 @@ namespace DualScreenDemo
switch (data.Command) switch (data.Command)
{ {
case "pause": case "pause":
// 执行暂停操作 // 执行暂停操作
if (VideoPlayerForm.Instance.isPaused) if (VideoPlayerForm.Instance.isPaused)
{ {
PrimaryForm.Instance.videoPlayerForm.Play(); PrimaryForm.Instance.Invoke(new System.Action(() =>
PrimaryForm.Instance.pauseButton.Visible = true; {
PrimaryForm.Instance.playButton.Visible = false; PrimaryForm.Instance.videoPlayerForm.Play();
PrimaryForm.Instance.syncPauseButton.Visible = true; PrimaryForm.Instance.pauseButton.Visible = true;
PrimaryForm.Instance.syncPlayButton.Visible = false; PrimaryForm.Instance.playButton.Visible = false;
PrimaryForm.Instance.syncPauseButton.Visible = true;
PrimaryForm.Instance.syncPlayButton.Visible = false;
}));
} }
else else
{ {
PrimaryForm.Instance.videoPlayerForm.Pause(); PrimaryForm.Instance.Invoke(new System.Action(() =>
PrimaryForm.Instance.pauseButton.Visible = false; {
PrimaryForm.Instance.playButton.Visible = true; PrimaryForm.Instance.videoPlayerForm.Pause();
PrimaryForm.Instance.syncPauseButton.Visible = false; PrimaryForm.Instance.pauseButton.Visible = false;
PrimaryForm.Instance.syncPlayButton.Visible = true; PrimaryForm.Instance.playButton.Visible = true;
PrimaryForm.Instance.syncPauseButton.Visible = false;
PrimaryForm.Instance.syncPlayButton.Visible = true;
}));
} }
break; break;
case "volume_up": case "volume_up":
// 执行音量增大操作 // 执行音量增大操作
PrimaryForm.SendCommandThroughSerialPort("a2 b3 a4"); PrimaryForm.SendCommandThroughSerialPort("a2 b3 a4");
OverlayForm.MainForm.Invoke(new System.Action(() => { OverlayForm.MainForm.Invoke(new System.Action(() =>
{
OverlayForm.MainForm.ShowVolumeUpLabel(); OverlayForm.MainForm.ShowVolumeUpLabel();
PrimaryForm.Instance.volumeUpTimer.Start();
OverlayForm.MainForm.HideAllLabels();
PrimaryForm.Instance.volumeUpTimer.Stop();
})); }));
break; break;
case "mic_up": case "mic_up":
// 执行麦克风增大操作 // 执行麦克风增大操作
PrimaryForm.SendCommandThroughSerialPort("a2 b5 a4"); PrimaryForm.SendCommandThroughSerialPort("a2 b5 a4");
OverlayForm.MainForm.Invoke(new System.Action(() => { OverlayForm.MainForm.Invoke(new System.Action(() =>
{
OverlayForm.MainForm.ShowMicUpLabel(); OverlayForm.MainForm.ShowMicUpLabel();
PrimaryForm.Instance.micControlTimer.Start();
OverlayForm.MainForm.HideAllLabels();
PrimaryForm.Instance.micControlTimer.Stop();
})); }));
break; break;
case "mute": case "mute":
@ -485,15 +500,23 @@ namespace DualScreenDemo
case "volume_down": case "volume_down":
// 执行音量减小操作 // 执行音量减小操作
PrimaryForm.SendCommandThroughSerialPort("a2 b4 a4"); PrimaryForm.SendCommandThroughSerialPort("a2 b4 a4");
OverlayForm.MainForm.Invoke(new System.Action(() => { OverlayForm.MainForm.Invoke(new System.Action(() =>
{
OverlayForm.MainForm.ShowVolumeDownLabel(); OverlayForm.MainForm.ShowVolumeDownLabel();
PrimaryForm.Instance.volumeDownTimer.Start();
OverlayForm.MainForm.HideAllLabels();
PrimaryForm.Instance.volumeDownTimer.Stop();
})); }));
break; break;
case "mic_down": case "mic_down":
// 执行麦克风减小操作 // 执行麦克风减小操作
PrimaryForm.SendCommandThroughSerialPort("a2 b6 a4"); PrimaryForm.SendCommandThroughSerialPort("a2 b6 a4");
OverlayForm.MainForm.Invoke(new System.Action(() => { OverlayForm.MainForm.Invoke(new System.Action(() =>
{
OverlayForm.MainForm.ShowMicDownLabel(); OverlayForm.MainForm.ShowMicDownLabel();
PrimaryForm.Instance.micControlTimer.Start();
OverlayForm.MainForm.HideAllLabels();
PrimaryForm.Instance.micControlTimer.Stop();
})); }));
break; break;
case "original_song": case "original_song":

View File

@ -2,7 +2,7 @@ using System.IO;
using Microsoft.Win32; using Microsoft.Win32;
using System.Diagnostics; using System.Diagnostics;
using DBObj; using DBObj;
using HeartbeatSender; using DataCheck;
namespace DualScreenDemo namespace DualScreenDemo
{ {
@ -17,16 +17,28 @@ namespace DualScreenDemo
[STAThread] [STAThread]
static void Main() static void Main()
{ {
Console.WriteLine("隱藏滑鼠游標"); Console.WriteLine("隱藏滑鼠游標");
// Cursor.Hide(); Cursor.Hide();
AppDomain.CurrentDomain.ProcessExit += (s, e) => AppDomain.CurrentDomain.ProcessExit += (s, e) =>
{ {
Cursor.Show(); Cursor.Show();
}; };
Console.WriteLine("正在喚醒SVR裝置(每3分鐘呼叫一次)...");
_ = Task.Run(async () =>
{
while (true)
{
_ = Directory.Exists(@"\\svr01\video");
_ = Directory.Exists(@"\\svr02\video");
await Task.Delay(180000); // 每3min送一次
}
});
// Console.WriteLine("正在與中控取得聯繫...");
var sender = new HeartbeatSender.heartbeatSender();
Console.WriteLine("正在與中控取得聯繫");
/*var sender = new HeartbeatSender.heartbeatSender();
// 同步呼叫非同步登入取得 token // 同步呼叫非同步登入取得 token
bool loginSuccess = sender.LoginAndGetTokenAsync().GetAwaiter().GetResult(); bool loginSuccess = sender.LoginAndGetTokenAsync().GetAwaiter().GetResult();
@ -35,21 +47,26 @@ namespace DualScreenDemo
// 先送一次心跳 (同步呼叫) // 先送一次心跳 (同步呼叫)
sender.SendHeartbeatAsync().GetAwaiter().GetResult(); sender.SendHeartbeatAsync().GetAwaiter().GetResult();
// 背景持續每3秒送心跳 // 背景持續每5分鐘送心跳
_ = Task.Run(async () => _ = Task.Run(async () =>
{ {
while (true) while (true)
{ {
await sender.SendHeartbeatAsync(); await sender.SendHeartbeatAsync();
await Task.Delay(300000); // 每3秒送一次 await Task.Delay(300000); // 每5min送一次
} }
}); });
Console.WriteLine("正在發送心跳中...");
} }
else else
{ {
Console.WriteLine("登入失敗,無法送出心跳"); Console.WriteLine("登入失敗,無法送出心跳");
} }
*/ //之後需要做添加同步菜單+酒單+背景圖(若圖規格有做正規化)
// DataCheck.cs 有預寫好相關流程函式
Console.WriteLine("更新菜單和酒單...");
dataCheck Checkprocess = new dataCheck();
try try
{ {
// COM 初始化 // COM 初始化
@ -62,7 +79,7 @@ namespace DualScreenDemo
// 初始化管理器 // 初始化管理器
songListManager = new SongListManager(); // 使用单例 songListManager = new SongListManager(); // 使用单例
//artistManager = new ArtistManager(); //artistManager = new ArtistManager();
var commandHandler = new CommandHandler(songListManager); var commandHandler = new CommandHandler(songListManager);
serialPortManager = new SerialPortManager(commandHandler); serialPortManager = new SerialPortManager(commandHandler);
@ -106,9 +123,22 @@ namespace DualScreenDemo
primaryForm.ShowSendOffScreen(); primaryForm.ShowSendOffScreen();
}; };
} }
WatchDog _watchDog = new WatchDog(
() => VideoPlayerForm.Instance.GetCurrentVideoStatus(),
() => primaryForm.IsAppResponsive()
);
_watchDog.Start();
Console.WriteLine("啟動WatchDog進行監聽");
AppDomain.CurrentDomain.ProcessExit += (s, e) =>
{
_watchDog.Stop();
};
primaryForm.Show(); primaryForm.Show();
Application.Run(primaryForm); Application.Run(primaryForm);
} }
catch (Exception ex) catch (Exception ex)
{ {