Files
Electron.NET/ElectronNET.WebApp/Controllers/HomeController.cs

48 lines
1.3 KiB
C#
Raw Permalink Normal View History

using Microsoft.AspNetCore.Mvc;
2020-05-11 12:59:21 -05:00
using ElectronNET.API;
using System;
2017-10-03 04:40:37 +02:00
namespace ElectronNET.WebApp.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
2020-05-11 12:59:21 -05:00
if (HybridSupport.IsElectronActive)
{
Electron.PowerMonitor.OnLockScreen += () =>
{
Console.WriteLine("Screen Locked detected from C#");
2020-05-11 12:59:21 -05:00
};
Electron.PowerMonitor.OnUnLockScreen += () =>
{
Console.WriteLine("Screen unlocked detected from C# ");
2020-05-11 12:59:21 -05:00
};
2020-05-17 22:16:31 -05:00
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");
2020-05-17 22:16:31 -05:00
};
2020-05-11 12:59:21 -05:00
}
return View();
}
2017-10-03 04:40:37 +02:00
}
}