forked from ElectronNET/Electron.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHomeController.cs
More file actions
48 lines (40 loc) · 1.33 KB
/
Copy pathHomeController.cs
File metadata and controls
48 lines (40 loc) · 1.33 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using Microsoft.AspNetCore.Mvc;
using ElectronNET.API;
using System;
namespace ElectronNET.WebApp.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
if (HybridSupport.IsElectronActive)
{
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();
}
}
}