Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4cd7e74923 | |||
| d65c556656 | |||
| fe3941d8bd |
@@ -1,4 +1,6 @@
|
|||||||
using Serilog;
|
using HardwareMonitorStatusWindow.Service;
|
||||||
|
using Microsoft.Win32.TaskScheduler;
|
||||||
|
using Serilog;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using Velopack;
|
using Velopack;
|
||||||
@@ -17,7 +19,30 @@ internal class Program
|
|||||||
|
|
||||||
Log.Information("Start");
|
Log.Information("Start");
|
||||||
|
|
||||||
VelopackApp.Build().SetLogger(new SerilogVelopackLogger()).Run();
|
var stopServiceHook = new VelopackHook(_ =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using var taskService = new TaskService();
|
||||||
|
|
||||||
|
Log.Information("Checking for task name: {name}", HardwareMonitorService.ScheduledTaskName);
|
||||||
|
|
||||||
|
var existingTask = taskService.FindTask(HardwareMonitorService.ScheduledTaskName);
|
||||||
|
|
||||||
|
Log.Information("Task: {existingTask}", existingTask);
|
||||||
|
|
||||||
|
Log.Information("Stopping task");
|
||||||
|
|
||||||
|
existingTask?.Stop();
|
||||||
|
}
|
||||||
|
catch (Exception exception)
|
||||||
|
{
|
||||||
|
// Ignored
|
||||||
|
Log.Error(exception, "");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
VelopackApp.Build().OnBeforeUpdateFastCallback(stopServiceHook).OnBeforeUninstallFastCallback(stopServiceHook).SetLogger(new SerilogVelopackLogger()).Run();
|
||||||
|
|
||||||
var app = new App();
|
var app = new App();
|
||||||
app.InitializeComponent();
|
app.InitializeComponent();
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ namespace HardwareMonitorStatusWindow.StatusWindow;
|
|||||||
|
|
||||||
internal static class UpdateCheck
|
internal static class UpdateCheck
|
||||||
{
|
{
|
||||||
private static UpdateManager _updateManager;
|
private static UpdateManager? _updateManager;
|
||||||
|
|
||||||
public static UpdateManager UpdateManager => _updateManager ??= new UpdateManager(new GithubSource("https://gitea.kaczorzoo.net/ckaczor/HardwareMonitorStatusWindow", null, false));
|
public static UpdateManager UpdateManager => _updateManager ??= new UpdateManager(new GiteaSource("https://gitea.kaczorzoo.net/ckaczor/HardwareMonitorStatusWindow", null, false));
|
||||||
|
|
||||||
public static string LocalVersion => (UpdateManager.CurrentVersion ?? new SemanticVersion(0, 0, 0)).ToString();
|
public static string LocalVersion => (UpdateManager.CurrentVersion ?? new SemanticVersion(0, 0, 0)).ToString();
|
||||||
|
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ internal class WindowSource : IWindowSource, IDisposable
|
|||||||
Data.Load();
|
Data.Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Save()
|
private static void Save()
|
||||||
{
|
{
|
||||||
Data.Save();
|
Data.Save();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user