2017-10-21 04:37:01 +02:00
|
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
|
|
using ElectronNET.API;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
|
|
namespace ElectronNET.WebApp.Controllers
|
|
|
|
|
|
{
|
|
|
|
|
|
public class IpcController : Controller
|
|
|
|
|
|
{
|
|
|
|
|
|
public IActionResult Index()
|
|
|
|
|
|
{
|
2017-10-23 21:24:05 +02:00
|
|
|
|
if(HybridSupport.IsElectronActive)
|
2017-10-21 04:37:01 +02:00
|
|
|
|
{
|
2017-10-23 21:24:05 +02:00
|
|
|
|
Electron.IpcMain.On("async-msg", (args) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
var mainWindow = Electron.WindowManager.BrowserWindows.First();
|
|
|
|
|
|
Electron.IpcMain.Send(mainWindow, "asynchronous-reply", "pong");
|
|
|
|
|
|
});
|
2017-10-21 04:37:01 +02:00
|
|
|
|
|
2017-10-23 21:24:05 +02:00
|
|
|
|
Electron.IpcMain.OnSync("sync-msg", (args) =>
|
|
|
|
|
|
{
|
|
|
|
|
|
return "pong";
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2017-10-21 04:37:01 +02:00
|
|
|
|
|
|
|
|
|
|
return View();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|