forked from ElectronNET/Electron.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdateController.cs
More file actions
31 lines (27 loc) · 1.13 KB
/
Copy pathUpdateController.cs
File metadata and controls
31 lines (27 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System.Linq;
using ElectronNET.API;
using Microsoft.AspNetCore.Mvc;
namespace ElectronNET.WebApp.Controllers
{
public class UpdateController : Controller
{
public IActionResult Index()
{
if (HybridSupport.IsElectronActive)
{
Electron.IpcMain.On("auto-update", async (args) =>
{
// Electron.NET CLI Command for deploy:
// electronize build /target win /electron-params --publish=always
var currentVersion = await Electron.App.GetVersionAsync();
var updateCheckResult = await Electron.AutoUpdater.CheckForUpdatesAndNotifyAsync();
var availableVersion = updateCheckResult.UpdateInfo.Version;
string information = $"Current version: {currentVersion} - available version: {availableVersion}";
var mainWindow = Electron.WindowManager.BrowserWindows.First();
Electron.IpcMain.Send(mainWindow, "auto-update-reply", information);
});
}
return View();
}
}
}