From 258710bc52056cbd339c10e9087483eed7d2e0e9 Mon Sep 17 00:00:00 2001 From: Gustavo Lara Molina Date: Tue, 2 Jun 2020 09:31:15 -0500 Subject: [PATCH] =?UTF-8?q?removing=20PM=20methods=20with=20issues=20for?= =?UTF-8?q?=20this=20versi=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ElectronNET.API/PowerMonitor.cs | 41 ------------------- ElectronNET.Host/api/powerMonitor.js | 8 ---- ElectronNET.Host/api/powerMonitor.js.map | 2 +- ElectronNET.Host/api/powerMonitor.ts | 10 ----- .../Controllers/HomeController.cs | 2 +- 5 files changed, 2 insertions(+), 61 deletions(-) diff --git a/ElectronNET.API/PowerMonitor.cs b/ElectronNET.API/PowerMonitor.cs index 2bed8e9..03e6874 100644 --- a/ElectronNET.API/PowerMonitor.cs +++ b/ElectronNET.API/PowerMonitor.cs @@ -215,47 +215,6 @@ namespace ElectronNET.API private event Action _shutdown; - /// - /// Idle time in seconds - /// Calculate system idle time in seconds. - /// - public Task GetSystemIdleTimeAsync() - { - var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("pm-getSystemIdleTime-completed", (idleTime) => - { - BridgeConnector.Socket.Off("pm-getSystemIdleTime-completed"); - taskCompletionSource.SetResult((int)idleTime); - }); - - BridgeConnector.Socket.Emit("pm-getSystemIdleTime"); - - return taskCompletionSource.Task; - } - - /// - /// The system's current state. Can be `active`, `idle`, `locked` or `unknown`. - /// - /// Calculate the system idle state. `idleThreshold` is the amount of time (in - /// seconds) before considered idle. `locked` is available on supported systems - /// only. - /// - public Task GetSystemIdleStateAsync(int IdleThreshold) - { - var taskCompletionSource = new TaskCompletionSource(); - - BridgeConnector.Socket.On("pm-getSystemIdleState-completed", (idleTime) => - { - BridgeConnector.Socket.Off("pm-getSystemIdleState-completed"); - taskCompletionSource.SetResult((string)idleTime); - }); - - BridgeConnector.Socket.Emit("pm-getSystemIdleState"); - - return taskCompletionSource.Task; - } - private static PowerMonitor _powerMonitor; private static object _syncRoot = new object(); diff --git a/ElectronNET.Host/api/powerMonitor.js b/ElectronNET.Host/api/powerMonitor.js index a679565..0b4dd7a 100644 --- a/ElectronNET.Host/api/powerMonitor.js +++ b/ElectronNET.Host/api/powerMonitor.js @@ -38,13 +38,5 @@ module.exports = (socket) => { electronSocket.emit('pm-shutdown'); }); }); - socket.on('pm-getSystemIdleTime', () => { - var idleTime = electron_1.powerMonitor.getSystemIdleTime(); - electronSocket.emit('pm-getSystemIdleTime-completed', idleTime); - }); - socket.on('pm-getSystemIdleState', (idleThreshold) => { - var idleState = electron_1.powerMonitor.getSystemIdleState(idleThreshold); - electronSocket.emit('pm-getSystemIdleState-completed', idleState); - }); }; //# sourceMappingURL=powerMonitor.js.map \ No newline at end of file diff --git a/ElectronNET.Host/api/powerMonitor.js.map b/ElectronNET.Host/api/powerMonitor.js.map index 6e03906..51c5763 100644 --- a/ElectronNET.Host/api/powerMonitor.js.map +++ b/ElectronNET.Host/api/powerMonitor.js.map @@ -1 +1 @@ -{"version":3,"file":"powerMonitor.js","sourceRoot":"","sources":["powerMonitor.ts"],"names":[],"mappings":";AAAA,uCAAwC;AACxC,IAAI,cAAc,CAAC;AAEnB,iBAAS,CAAC,MAAuB,EAAE,EAAE;IACjC,cAAc,GAAG,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACtC,uBAAY,CAAC,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;YAChC,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACxC,uBAAY,CAAC,EAAE,CAAC,eAAe,EAAE,GAAG,EAAE;YAClC,cAAc,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC5C,CAAC,CAAC,CAAC;IACP,C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C,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,mBAAmB,EAAE,GAAG,EAAE;QAChC,uBAAY,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YAC1B,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACpC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;QACrC,uBAAY,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,EAAE;YAC/B,cAAc,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACnC,uBAAY,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE;YAC7B,cAAc,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"} \ No newline at end of file diff --git a/ElectronNET.Host/api/powerMonitor.ts b/ElectronNET.Host/api/powerMonitor.ts index e6aa070..30b42df 100644 --- a/ElectronNET.Host/api/powerMonitor.ts +++ b/ElectronNET.Host/api/powerMonitor.ts @@ -38,14 +38,4 @@ export = (socket: SocketIO.Socket) => { electronSocket.emit('pm-shutdown'); }); }); - socket.on('pm-getSystemIdleTime', () => { - var idleTime = powerMonitor.getSystemIdleTime(); - - electronSocket.emit('pm-getSystemIdleTime-completed', idleTime); - }); - socket.on('pm-getSystemIdleState', (idleThreshold ) => { - var idleState = powerMonitor.getSystemIdleState(idleThreshold ); - - electronSocket.emit('pm-getSystemIdleState-completed', idleState); - }); }; diff --git a/ElectronNET.WebApp/Controllers/HomeController.cs b/ElectronNET.WebApp/Controllers/HomeController.cs index a375660..e4dfa30 100644 --- a/ElectronNET.WebApp/Controllers/HomeController.cs +++ b/ElectronNET.WebApp/Controllers/HomeController.cs @@ -37,7 +37,7 @@ namespace ElectronNET.WebApp.Controllers Electron.PowerMonitor.OnBattery += () => { - Console.WriteLine("The system about to changes to battery power"); + Console.WriteLine("The system is about to change to battery power"); }; }