mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-07-15 13:16:03 +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:
34
ElectronNET.WebApp/Controllers/TrayController.cs
Normal file
34
ElectronNET.WebApp/Controllers/TrayController.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ElectronNET.API;
|
||||
using ElectronNET.API.Entities;
|
||||
|
||||
namespace ElectronNET.WebApp.Controllers
|
||||
{
|
||||
public class TrayController : Controller
|
||||
{
|
||||
public IActionResult Index()
|
||||
{
|
||||
Electron.IpcMain.On("put-in-tray", (args) => {
|
||||
|
||||
if (Electron.Tray.Items.Count == 0)
|
||||
{
|
||||
var menu = new MenuItem
|
||||
{
|
||||
Label = "Remove",
|
||||
Click = () => Electron.Tray.Destroy()
|
||||
};
|
||||
|
||||
Electron.Tray.Show("/Assets/electron_32x32.png", menu);
|
||||
Electron.Tray.SetToolTip("Electron Demo in the tray.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Electron.Tray.Destroy();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
return View();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user