From bca0262e2329e25c4f9404ba2ecd210386c5818d Mon Sep 17 00:00:00 2001 From: Cezary Piatek Date: Wed, 18 Sep 2024 19:27:00 +0200 Subject: [PATCH 1/3] Add nuget source explicitly for updater --- src/ScriptRunner/AppInstaller/Program.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ScriptRunner/AppInstaller/Program.cs b/src/ScriptRunner/AppInstaller/Program.cs index 02664bb..7e983a8 100644 --- a/src/ScriptRunner/AppInstaller/Program.cs +++ b/src/ScriptRunner/AppInstaller/Program.cs @@ -42,7 +42,9 @@ private static Command CreateUpdateDotnetToolCommand() updateDotnetToolCommand.SetHandler((packageName, version) => { Console.WriteLine($"Updating dotnet tool {packageName}"); - var command = string.IsNullOrWhiteSpace(version) == false? $"tool update {packageName} --global --no-cache --ignore-failed-sources --version {version}": $"tool update {packageName} --global --no-cache --ignore-failed-sources"; + var command = string.IsNullOrWhiteSpace(version) == false + ? $"tool update {packageName} --global --no-cache --ignore-failed-sources --version {version} --add-source https://api.nuget.org/v3/index.json" + : $"tool update {packageName} --global --no-cache --ignore-failed-sources --add-source https://api.nuget.org/v3/index.json"; var process = Process.Start("dotnet", command); process.WaitForExit(); if (process.ExitCode != 0) From 81a25109756b3147723283ad9a10be3b6eb9453f Mon Sep 17 00:00:00 2001 From: Cezary Piatek Date: Wed, 18 Sep 2024 19:54:18 +0200 Subject: [PATCH 2/3] Add option to refresh info about required updates --- .../ViewModels/MainWindowViewModel.cs | 49 ++++++++++++------- .../ScriptRunner.GUI/Views/SideMenu.axaml | 2 +- 2 files changed, 32 insertions(+), 19 deletions(-) diff --git a/src/ScriptRunner/ScriptRunner.GUI/ViewModels/MainWindowViewModel.cs b/src/ScriptRunner/ScriptRunner.GUI/ViewModels/MainWindowViewModel.cs index 0b86efc..212e9b5 100644 --- a/src/ScriptRunner/ScriptRunner.GUI/ViewModels/MainWindowViewModel.cs +++ b/src/ScriptRunner/ScriptRunner.GUI/ViewModels/MainWindowViewModel.cs @@ -305,28 +305,13 @@ public MainWindowViewModel(ParamsPanelFactory paramsPanelFactory, VaultProvider _appUpdateScheduler = new RealTimeScheduler(TimeSpan.FromDays(1), TimeSpan.FromHours(1), async () => { - var isNewerVersion = await appUpdater.CheckIsNewerVersionAvailable(); - if (isNewerVersion) - { - Dispatcher.UIThread.Post(() => - { - ShowNewVersionAvailable = true; - }); - } + await RefreshInfoAbouAppUpdates(); }); _appUpdateScheduler.Run(); - _outdatedRepoCheckingScheduler = new RealTimeScheduler(TimeSpan.FromHours( - 4), TimeSpan.FromHours(1), async () => + _outdatedRepoCheckingScheduler = new RealTimeScheduler(TimeSpan.FromHours(4), TimeSpan.FromHours(1), async () => { - var outOfDateRepos = await _configRepositoryUpdater.CheckAllRepositories(); - Dispatcher.UIThread.Post(() => - { - OutOfDateConfigRepositories.Clear(); - OutOfDateConfigRepositories.AddRange(outOfDateRepos); - }); - - + await RefreshInfoAboutRepositories(); }); _outdatedRepoCheckingScheduler.Run(); @@ -336,6 +321,28 @@ public MainWindowViewModel(ParamsPanelFactory paramsPanelFactory, VaultProvider BuildUi(); } + private async Task RefreshInfoAbouAppUpdates() + { + var isNewerVersion = await appUpdater.CheckIsNewerVersionAvailable(); + if (isNewerVersion) + { + Dispatcher.UIThread.Post(() => + { + ShowNewVersionAvailable = true; + }); + } + } + + private async Task RefreshInfoAboutRepositories() + { + var outOfDateRepos = await _configRepositoryUpdater.CheckAllRepositories(); + Dispatcher.UIThread.Post(() => + { + OutOfDateConfigRepositories.Clear(); + OutOfDateConfigRepositories.AddRange(outOfDateRepos); + }); + } + public void CheckForUpdates() { appUpdater.OpenLatestReleaseLog(); @@ -555,6 +562,12 @@ public void OpenSettingsWindow() } } + public void ForceRefresh() + { + _ = RefreshInfoAbouAppUpdates(); + _ = RefreshInfoAboutRepositories(); + BuildUi(); + } public void RefreshSettings() => BuildUi(); public void OpenVaultWindow() => TryToOpenDialog(); diff --git a/src/ScriptRunner/ScriptRunner.GUI/Views/SideMenu.axaml b/src/ScriptRunner/ScriptRunner.GUI/Views/SideMenu.axaml index 61b4f74..637f78b 100644 --- a/src/ScriptRunner/ScriptRunner.GUI/Views/SideMenu.axaml +++ b/src/ScriptRunner/ScriptRunner.GUI/Views/SideMenu.axaml @@ -25,7 +25,7 @@