mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-05 13:54:47 +00:00
48 lines
1.3 KiB
C#
48 lines
1.3 KiB
C#
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();
|
|
}
|
|
}
|
|
} |