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

38 lines
1.0 KiB
C#
Raw Normal View History

using Microsoft.AspNetCore.Mvc;
using ElectronNET.API;
using ElectronNET.API.Entities;
namespace ElectronNET.WebApp.Controllers
{
public class TrayController : Controller
{
public IActionResult Index()
{
2017-10-23 21:24:05 +02:00
if (HybridSupport.IsElectronActive)
{
Electron.IpcMain.On("put-in-tray", (args) =>
{
2017-10-23 21:24:05 +02:00
2017-10-25 21:28:43 +02:00
if (Electron.Tray.MenuItems.Count == 0)
{
2017-10-23 21:24:05 +02:00
var menu = new MenuItem
{
Label = "Remove",
Click = () => Electron.Tray.Destroy()
};
2017-10-23 21:24:05 +02:00
Electron.Tray.Show("/Assets/electron_32x32.png", menu);
Electron.Tray.SetToolTip("Electron Demo in the tray.");
}
else
{
Electron.Tray.Destroy();
}
2017-10-23 21:24:05 +02:00
});
}
return View();
}
}
}