Fixed bug: Electron tray icon TypeError

This commit is contained in:
Yevgeniy Tymchishin
2019-07-05 23:33:04 +03:00
parent ad399f50ee
commit b9ba162a88
5 changed files with 27 additions and 7 deletions

View File

@@ -1,11 +1,21 @@
using Microsoft.AspNetCore.Mvc;
using System.IO;
using Microsoft.AspNetCore.Mvc;
using ElectronNET.API;
using ElectronNET.API.Entities;
using Microsoft.AspNetCore.Hosting;
namespace ElectronNET.WebApp.Controllers
{
public class TrayController : Controller
{
private readonly IHostingEnvironment _env;
public TrayController(IHostingEnvironment env)
{
_env = env;
}
public IActionResult Index()
{
if (HybridSupport.IsElectronActive)
@@ -21,7 +31,7 @@ namespace ElectronNET.WebApp.Controllers
Click = () => Electron.Tray.Destroy()
};
Electron.Tray.Show("/Assets/electron_32x32.png", menu);
Electron.Tray.Show(Path.Combine(_env.ContentRootPath, "Assets/electron_32x32.png"), menu);
Electron.Tray.SetToolTip("Electron Demo in the tray.");
}
else