mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-02-14 21:24:58 +00:00
implement Demo App sections: Dialogs, Menu, Tray, Shell, CrashHang, Notification, Shortcuts etc. Fix some API bugs and implement GlobalShortcut-, Shell- and WebContents-API.
This commit is contained in:
40
ElectronNET.WebApp/Controllers/NotificationsController.cs
Normal file
40
ElectronNET.WebApp/Controllers/NotificationsController.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
|
||||
namespace ElectronNET.WebApp.Controllers
|
||||
{
|
||||
public class NotificationsController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user