隱藏滑鼠游標調整
This commit is contained in:
parent
68501300a6
commit
3f5f0e5d08
@ -15,6 +15,7 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
if (currentSequence[currentSequence.Count - 1] != correctSequence[currentSequence.Count - 1])
|
if (currentSequence[currentSequence.Count - 1] != correctSequence[currentSequence.Count - 1])
|
||||||
{
|
{
|
||||||
|
Console.WriteLine(currentSequence[currentSequence.Count - 1] +" 比對 " + correctSequence[currentSequence.Count - 1] +" 順序錯誤,重置序列");
|
||||||
// 順序錯誤,重置序列
|
// 順序錯誤,重置序列
|
||||||
currentSequence.Clear();
|
currentSequence.Clear();
|
||||||
return;
|
return;
|
||||||
@ -26,16 +27,23 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 使用 Windows 命令關機
|
// ✅ 這行要在主執行緒執行,避免 UI 錯誤
|
||||||
System.Diagnostics.Process.Start("shutdown", "/s /t 0");
|
Cursor.Show();
|
||||||
|
|
||||||
|
Console.WriteLine("使用 Windows 命令關機");
|
||||||
|
|
||||||
|
// ✅ 關機動作移到背景執行緒
|
||||||
|
new System.Threading.Thread(() =>
|
||||||
|
{
|
||||||
|
System.Diagnostics.Process.Start("shutdown", "/s /t 0");
|
||||||
|
}).Start();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"關機失敗: {ex.Message}");
|
MessageBox.Show($"關機失敗: {ex.Message}");
|
||||||
// 如果關機失敗,退出程式
|
|
||||||
Application.Exit();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
Program.cs
11
Program.cs
@ -17,8 +17,15 @@ namespace DualScreenDemo
|
|||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
|
Console.WriteLine("隱藏滑鼠游標");
|
||||||
|
Cursor.Hide();
|
||||||
|
AppDomain.CurrentDomain.ProcessExit += (s, e) =>
|
||||||
|
{
|
||||||
|
Cursor.Show();
|
||||||
|
};
|
||||||
|
|
||||||
Console.WriteLine("正在與中控取得聯繫");
|
Console.WriteLine("正在與中控取得聯繫");
|
||||||
var sender = new HeartbeatSender.heartbeatSender("http://zqd.superstar.dnsnet.cc/api/room/receiveRegister");
|
var sender = new HeartbeatSender.heartbeatSender();
|
||||||
|
|
||||||
// 同步呼叫非同步登入取得 token
|
// 同步呼叫非同步登入取得 token
|
||||||
bool loginSuccess = sender.LoginAndGetTokenAsync().GetAwaiter().GetResult();
|
bool loginSuccess = sender.LoginAndGetTokenAsync().GetAwaiter().GetResult();
|
||||||
@ -181,7 +188,7 @@ namespace DualScreenDemo
|
|||||||
{
|
{
|
||||||
if (primaryForm.videoPlayerForm == null)
|
if (primaryForm.videoPlayerForm == null)
|
||||||
{
|
{
|
||||||
var filePath = @"C:\\video\\100015-周杰倫&aMei-不該-國語-vL-100-11000001.mpg";
|
var filePath = @"D:\\video\\100015-周杰倫&aMei-不該-國語-vL-100-11000001.mpg";
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath))
|
||||||
{
|
{
|
||||||
Screen secondaryScreen = Screen.AllScreens.FirstOrDefault(s => !s.Primary);
|
Screen secondaryScreen = Screen.AllScreens.FirstOrDefault(s => !s.Primary);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user