202508081053
修正Room State 相同不做動作 修正包廂結束 不做 add close 歌曲
This commit is contained in:
parent
f8a6e5c40d
commit
b6e9bc45c6
@ -71,18 +71,12 @@ namespace DBObj
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Console.WriteLine($"伺服器路徑: '{server}'");
|
|
||||||
string fullPath = Path.Combine(server, basic.getFileName());
|
string fullPath = Path.Combine(server, basic.getFileName());
|
||||||
|
|
||||||
if (File.Exists(fullPath))
|
if (File.Exists(fullPath))
|
||||||
{
|
{
|
||||||
Console.WriteLine($"找到檔案: {fullPath}");
|
Console.WriteLine($"找到檔案: {fullPath}");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Console.WriteLine($"找不到檔案: {fullPath}");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -102,7 +96,6 @@ namespace DBObj
|
|||||||
{
|
{
|
||||||
foreach (var server in Utils.Env.GetSongServers())
|
foreach (var server in Utils.Env.GetSongServers())
|
||||||
{
|
{
|
||||||
Console.WriteLine($"伺服器路徑: '{server}'");
|
|
||||||
string fullPath = Path.Combine(server, filename);
|
string fullPath = Path.Combine(server, filename);
|
||||||
if (File.Exists(fullPath)) return fullPath;
|
if (File.Exists(fullPath)) return fullPath;
|
||||||
}
|
}
|
||||||
|
@ -139,8 +139,6 @@ namespace DBObj
|
|||||||
song.SetState(PlayState.Skipped);
|
song.SetState(PlayState.Skipped);
|
||||||
played.Add(song);
|
played.Add(song);
|
||||||
}
|
}
|
||||||
|
|
||||||
Add(close);
|
|
||||||
}
|
}
|
||||||
public static void clearSong()
|
public static void clearSong()
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace DualScreenDemo
|
|||||||
private static PrimaryForm primaryForm; // 儲存實例的參考
|
private static PrimaryForm primaryForm; // 儲存實例的參考
|
||||||
public static Room room = new Room();
|
public static Room room = new Room();
|
||||||
|
|
||||||
public static string verSion = "Server V2.8 202508071811";
|
public static string verSion = "Server V2.8 202508081053";
|
||||||
|
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
|
35
Room.cs
35
Room.cs
@ -32,6 +32,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
private string getDB()
|
private string getDB()
|
||||||
{
|
{
|
||||||
|
|
||||||
using (var db = new MyDB())
|
using (var db = new MyDB())
|
||||||
{
|
{
|
||||||
string query = @"SELECT * FROM rooms WHERE branch_id = @branch_id AND CONCAT(type, name) = @hostName";
|
string query = @"SELECT * FROM rooms WHERE branch_id = @branch_id AND CONCAT(type, name) = @hostName";
|
||||||
@ -41,11 +42,11 @@ namespace DualScreenDemo
|
|||||||
};
|
};
|
||||||
if (db.open(query, parameters) && db.found())
|
if (db.open(query, parameters) && db.found())
|
||||||
{
|
{
|
||||||
State = db.Field<string>("status");
|
var Statedb = db.Field<string>("status");
|
||||||
startedAt=ParseTime(db.Field<string>("started_at"));
|
startedAt = ParseTime(db.Field<string>("started_at"));
|
||||||
endedAt=ParseTime(db.Field<string>("ended_at"));
|
endedAt = ParseTime(db.Field<string>("ended_at"));
|
||||||
if (State.Equals("maintain")) { State = "active"; }
|
if (Statedb.Equals("maintain")) { Statedb = "active"; }
|
||||||
return State;
|
return Statedb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return "error";
|
return "error";
|
||||||
@ -66,25 +67,29 @@ namespace DualScreenDemo
|
|||||||
public void set(string value)
|
public void set(string value)
|
||||||
{
|
{
|
||||||
string StateDB=getDB();
|
string StateDB=getDB();
|
||||||
|
if (!StateDB.Equals(State))
|
||||||
Console.WriteLine($"hostname status: {hostName},{StateDB},{startedAt},{endedAt} ,{State}");
|
{
|
||||||
|
State = StateDB;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string marqueeMessage = "歡迎使用超級巨星歡唱,與你共度美好時光。";
|
string marqueeMessage = "歡迎使用超級巨星歡唱,與你共度美好時光。";
|
||||||
Color c = Color.White;
|
Color c = Color.White;
|
||||||
if (StateDB.Equals("fire"))
|
if (State.Equals("fire"))
|
||||||
{
|
{
|
||||||
PrimaryForm.Instance.ShowSendOffScreen();
|
PrimaryForm.Instance.ShowSendOffScreen();
|
||||||
VideoPlayerForm.Instance.Pause();
|
VideoPlayerForm.Instance.Pause();
|
||||||
marqueeMessage = "發生火災,請跟隨引導至逃生出口!!!";
|
marqueeMessage = "發生火災,請跟隨引導至逃生出口!!!";
|
||||||
c = Color.Red;
|
c = Color.Red;
|
||||||
}
|
}
|
||||||
else if (StateDB.Equals("active"))
|
else if (State.Equals("active"))
|
||||||
{
|
{
|
||||||
if (!State.Equals(StateDB))
|
DBObj.SongList.clearSong();
|
||||||
{
|
PrimaryForm.Instance.HotPlayButton_Click(null, EventArgs.Empty);
|
||||||
DBObj.SongList.clearSong();
|
PrimaryForm.Instance.HideSendOffScreen();
|
||||||
PrimaryForm.Instance.HotPlayButton_Click(null, EventArgs.Empty);
|
|
||||||
PrimaryForm.Instance.HideSendOffScreen();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -74,7 +74,7 @@ namespace DualScreenDemo
|
|||||||
|
|
||||||
public static OverlayForm overlayForm;
|
public static OverlayForm overlayForm;
|
||||||
public bool isMuted = false;
|
public bool isMuted = false;
|
||||||
public int previousVolume = -1000;
|
public int previousVolume = 0;
|
||||||
public bool isPaused = false;
|
public bool isPaused = false;
|
||||||
private bool isSyncToPrimaryMonitor = false;
|
private bool isSyncToPrimaryMonitor = false;
|
||||||
|
|
||||||
@ -363,14 +363,8 @@ namespace DualScreenDemo
|
|||||||
secondary.RenderMediaFile(pathToPlay,this.Handle,secondMonitor.Bounds.Width,secondMonitor.Bounds.Height);
|
secondary.RenderMediaFile(pathToPlay,this.Handle,secondMonitor.Bounds.Width,secondMonitor.Bounds.Height);
|
||||||
|
|
||||||
// 音量處理
|
// 音量處理
|
||||||
if (isMuted)
|
SetVolume(isMuted ? -10000 : previousVolume);
|
||||||
{
|
|
||||||
SetVolume(-10000);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SetVolume(previousVolume);
|
|
||||||
}
|
|
||||||
// 開始播放
|
// 開始播放
|
||||||
primary.Run();
|
primary.Run();
|
||||||
secondary.Run();
|
secondary.Run();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user