forked from ElectronNET/Electron.NET
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathHomeController.cs
More file actions
32 lines (25 loc) · 1.16 KB
/
HomeController.cs
File metadata and controls
32 lines (25 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Microsoft.AspNetCore.Mvc;
using ElectronNET.API;
using System;
namespace ElectronNET.WebApp.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
if (HybridSupport.IsElectronActive)
{
if (OperatingSystem.IsMacOS() || OperatingSystem.IsWindows())
{
Electron.PowerMonitor.OnLockScreen += () => { Console.WriteLine("Screen Locked detected from C#"); };
Electron.PowerMonitor.OnUnLockScreen += () => { Console.WriteLine("Screen unlocked detected from C# "); };
Electron.PowerMonitor.OnSuspend += () => { Console.WriteLine("The system is going to sleep"); };
Electron.PowerMonitor.OnResume += () => { Console.WriteLine("The system is resuming"); };
Electron.PowerMonitor.OnAC += () => { Console.WriteLine("The system changes to AC power"); };
Electron.PowerMonitor.OnBattery += () => { Console.WriteLine("The system is about to change to battery power"); };
}
}
return View();
}
}
}