mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-09 21:24:55 +00:00
28 lines
740 B
C#
28 lines
740 B
C#
using Microsoft.AspNetCore.Mvc;
|
|
using ElectronNET.API;
|
|
using System.Linq;
|
|
|
|
namespace ElectronNET.WebApp.Controllers
|
|
{
|
|
public class IpcController : Controller
|
|
{
|
|
public IActionResult Index()
|
|
{
|
|
if(HybridSupport.IsElectronActive)
|
|
{
|
|
Electron.IpcMain.On("async-msg", (args) =>
|
|
{
|
|
var mainWindow = Electron.WindowManager.BrowserWindows.First();
|
|
Electron.IpcMain.Send(mainWindow, "asynchronous-reply", "pong");
|
|
});
|
|
|
|
Electron.IpcMain.OnSync("sync-msg", (args) =>
|
|
{
|
|
return "pong";
|
|
});
|
|
}
|
|
|
|
return View();
|
|
}
|
|
}
|
|
} |