Windows - Fix crash when clicking on update notification

Meta - Code cleanup
This commit is contained in:
Robert committed 2022-09-03 10:34:53 +02:00
1 parent cdd814d920
commit 3994b49f08
36 files changed
+201 -193

No files matched your search

+6 -5
View File
@@ -24,11 +24,6 @@ public class App : Application
private StandardKernel? _kernel;
private bool _shutDown;
// ReSharper disable NotAccessedField.Local
private ApplicationStateManager? _applicationStateManager;
private Mutex? _artemisMutex;
// ReSharper restore NotAccessedField.Local
public override void Initialize()
{
// If Artemis is already running, bring it to foreground and stop this process
@@ -110,4 +105,10 @@ public class App : Application
}
}
}
// ReSharper disable NotAccessedField.Local
private ApplicationStateManager? _applicationStateManager;
private Mutex? _artemisMutex;
// ReSharper restore NotAccessedField.Local
}
@@ -17,10 +17,10 @@ public class WindowsInputProvider : InputProvider
private readonly IInputService _inputService;
private readonly ILogger _logger;
private readonly SpongeWindow _sponge;
private readonly Timer _taskManagerTimer;
private DateTime _lastMouseUpdate;
private int _lastProcessId;
private readonly SpongeWindow _sponge;
public WindowsInputProvider(ILogger logger, IInputService inputService)
{
@@ -24,8 +24,8 @@ namespace Artemis.UI.Windows.Providers;
public class UpdateProvider : IUpdateProvider, IDisposable
{
private const string ApiUrl = "https://dev.azure.com/artemis-rgb/Artemis/_apis/";
private const string InstallerUrl = "https://builds.artemis-rgb.com/binaries/Artemis.Installer.exe";
private const string API_URL = "https://dev.azure.com/artemis-rgb/Artemis/_apis/";
private const string INSTALLER_URL = "https://builds.artemis-rgb.com/binaries/Artemis.Installer.exe";
private readonly ILogger _logger;
private readonly IMainWindowService _mainWindowService;
@@ -42,7 +42,7 @@ public class UpdateProvider : IUpdateProvider, IDisposable
public async Task<DevOpsBuild?> GetBuildInfo(int buildDefinition, string? buildNumber = null)
{
Url request = ApiUrl.AppendPathSegments("build", "builds")
Url request = API_URL.AppendPathSegments("build", "builds")
.SetQueryParam("definitions", buildDefinition)
.SetQueryParam("resultFilter", "succeeded")
.SetQueryParam("$top", 1)
@@ -143,9 +143,9 @@ public class UpdateProvider : IUpdateProvider, IDisposable
string installerDirectory = Path.Combine(Constants.DataFolder, "installer");
string installerPath = Path.Combine(installerDirectory, "Artemis.Installer.exe");
_logger.Information("UpdateInstaller: Downloading installer from {DownloadUrl}", InstallerUrl);
_logger.Information("UpdateInstaller: Downloading installer from {DownloadUrl}", INSTALLER_URL);
using HttpClient client = new();
HttpResponseMessage httpResponseMessage = await client.GetAsync(InstallerUrl);
HttpResponseMessage httpResponseMessage = await client.GetAsync(INSTALLER_URL);
if (!httpResponseMessage.IsSuccessStatusCode)
throw new ArtemisUIException($"Failed to download installer, status code {httpResponseMessage.StatusCode}");