mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-11 05:34:34 +00:00
* Summaries rewritten * Added new parameters / Removed not supported parameters * Added some new methods like appFocus(options), appHasSingleLock, etc.
42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using System.Linq;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using ElectronNET.API;
|
|
using ElectronNET.API.Entities;
|
|
|
|
namespace ElectronNET.WebApp.Controllers
|
|
{
|
|
public class AppSysInformationController : Controller
|
|
{
|
|
public IActionResult Index()
|
|
{
|
|
if(HybridSupport.IsElectronActive)
|
|
{
|
|
Electron.IpcMain.On("app-info", async (args) =>
|
|
{
|
|
string appPath = await Electron.App.GetAppPathAsync();
|
|
|
|
var mainWindow = Electron.WindowManager.BrowserWindows.First();
|
|
Electron.IpcMain.Send(mainWindow, "got-app-path", appPath);
|
|
});
|
|
|
|
Electron.IpcMain.On("sys-info", async (args) =>
|
|
{
|
|
string homePath = await Electron.App.GetPathAsync(PathName.Home);
|
|
|
|
var mainWindow = Electron.WindowManager.BrowserWindows.First();
|
|
Electron.IpcMain.Send(mainWindow, "got-sys-info", homePath);
|
|
});
|
|
|
|
Electron.IpcMain.On("screen-info", async (args) =>
|
|
{
|
|
var display = await Electron.Screen.GetPrimaryDisplayAsync();
|
|
|
|
var mainWindow = Electron.WindowManager.BrowserWindows.First();
|
|
Electron.IpcMain.Send(mainWindow, "got-screen-info", display.Size);
|
|
});
|
|
}
|
|
|
|
return View();
|
|
}
|
|
}
|
|
} |