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

36 lines
1.2 KiB
C#
Raw Normal View History

2017-10-07 01:32:19 +02:00
using Microsoft.AspNetCore.Mvc;
using ElectronNET.API;
using ElectronNET.API.Entities;
using System.Linq;
2017-10-03 04:40:37 +02:00
namespace ElectronNET.WebApp.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
2017-10-14 17:58:16 +02:00
Electron.IpcMain.On("SayHello", (args) => {
Electron.Notification.Show(new NotificationOptions("Hallo Robert","Nachricht von ASP.NET Core App"));
2017-10-15 21:39:52 +02:00
Electron.IpcMain.Send(Electron.WindowManager.BrowserWindows.First(), "Goodbye", "Elephant!");
});
2017-10-14 17:58:16 +02:00
Electron.IpcMain.On("GetPath", async (args) =>
{
2017-10-15 21:39:52 +02:00
var currentBrowserWindow = Electron.WindowManager.BrowserWindows.First();
2017-10-14 17:58:16 +02:00
string pathName = await Electron.App.GetPathAsync(PathName.pictures);
2017-10-15 21:39:52 +02:00
Electron.IpcMain.Send(currentBrowserWindow, "GetPathComplete", pathName);
2017-10-15 21:39:52 +02:00
currentBrowserWindow.Minimize();
await Electron.WindowManager.CreateWindowAsync(new BrowserWindowOptions {
Title = "My second Window",
AutoHideMenuBar = true
},"http://www.google.de");
});
2017-10-07 01:32:19 +02:00
return View();
}
2017-10-03 04:40:37 +02:00
}
}