From f7d8eefe1c2dc921ebbba37dbed19552aeb4e994 Mon Sep 17 00:00:00 2001 From: Mossimo Date: Mon, 6 Dec 2021 14:35:30 +0800 Subject: [PATCH] save SystemSleep --- .../LinuxPlatformServiceImpl.cs | 20 ++++++++++++++ .../Implementation/MacPlatformServiceImpl.cs | 26 +++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/ST.Client.Desktop.Linux/Services/Implementation/LinuxPlatformServiceImpl.cs b/src/ST.Client.Desktop.Linux/Services/Implementation/LinuxPlatformServiceImpl.cs index 47ed40b1a..2f0f6b28a 100644 --- a/src/ST.Client.Desktop.Linux/Services/Implementation/LinuxPlatformServiceImpl.cs +++ b/src/ST.Client.Desktop.Linux/Services/Implementation/LinuxPlatformServiceImpl.cs @@ -153,5 +153,25 @@ namespace System.Application.Services.Implementation ((IPlatformService)this).RunShell(shellContent.ToString(), false); return true; } + + public void SystemLock(int waitSecond = 30) + { + throw new NotImplementedException(); + } + + public async void SystemShutdown(int waitSecond = 30) + { + + } + + public async void SystemSleep(int waitSecond = 30) + { + + } + + public async void SystemHibernate(int waitSecond = 30) + { + + } } } \ No newline at end of file diff --git a/src/ST.Client.Desktop.Mac/Services/Implementation/MacPlatformServiceImpl.cs b/src/ST.Client.Desktop.Mac/Services/Implementation/MacPlatformServiceImpl.cs index d1edb1c97..35e818ccc 100644 --- a/src/ST.Client.Desktop.Mac/Services/Implementation/MacPlatformServiceImpl.cs +++ b/src/ST.Client.Desktop.Mac/Services/Implementation/MacPlatformServiceImpl.cs @@ -248,5 +248,31 @@ namespace System.Application.Services.Implementation ((IPlatformService)this).RunShell(shellContent.ToString(), false); return true; } + + public void SystemLock(int waitSecond = 30) + { + throw new NotImplementedException(); + } + + public void SystemShutdown(int waitSecond = 30) + { + throw new NotImplementedException(); + } + + public void SystemSleep(int waitSecond = 30) + { + using var p = new Process(); + p.StartInfo.FileName = "osascript"; + p.StartInfo.Arguments = " -e ' tell application \"Finder\" to sleep do shell script \"Killall \" & quoted form of \"%s\"'"; + p.StartInfo.RedirectStandardOutput = true; + p.StartInfo.UseShellExecute = false; + p.StartInfo.CreateNoWindow = true; + + } + + public void SystemHibernate(int waitSecond = 30) + { + throw new NotImplementedException(); + } } } \ No newline at end of file