Files
Electron.NET/ElectronNET.WebApp/Controllers/NotificationsController.cs
Maher Jendoubi ed6ebe90b1 Fixed some spelling issues
* Cleanup of unnecessary usings
* Used language keywords instead of BCL types : Object --> object
* Fixed some spelling issues
2019-05-18 02:00:56 +02:00

39 lines
1.2 KiB
C#

using Microsoft.AspNetCore.Mvc;
using ElectronNET.API;
using ElectronNET.API.Entities;
namespace ElectronNET.WebApp.Controllers
{
public class NotificationsController : Controller
{
public IActionResult Index()
{
if(HybridSupport.IsElectronActive)
{
Electron.IpcMain.On("basic-noti", (args) => {
var options = new NotificationOptions("Basic Notification", "Short message part")
{
OnClick = async () => await Electron.Dialog.ShowMessageBoxAsync("Notification clicked")
};
Electron.Notification.Show(options);
});
Electron.IpcMain.On("advanced-noti", (args) => {
var options = new NotificationOptions("Notification with image", "Short message plus a custom image")
{
OnClick = async () => await Electron.Dialog.ShowMessageBoxAsync("Notification clicked"),
Icon = "/assets/img/programming.png"
};
Electron.Notification.Show(options);
});
}
return View();
}
}
}