Skip to content

Commit adebd0c

Browse files
committed
Code Quality: Set IsUpdateAvailable on UI thread for update services
Updated AppUpdateSideloadService and AppUpdateStoreService to set IsUpdateAvailable using DispatcherQueue. This ensures the property is updated on the UI thread, preventing potential threading issues.
1 parent d7a34ba commit adebd0c

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/Files.App/Services/App/AppUpdateSideloadService.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,10 @@ private async Task StartBackgroundDownloadAsync()
205205

206206
Logger?.LogInformation($"Download time taken: {timespan.Hours:00}:{timespan.Minutes:00}:{timespan.Seconds:00}");
207207

208-
IsUpdateAvailable = true;
208+
MainWindow.Instance.DispatcherQueue.TryEnqueue(() =>
209+
{
210+
IsUpdateAvailable = true;
211+
});
209212
}
210213
catch (IOException ex)
211214
{

src/Files.App/Services/App/AppUpdateStoreService.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,11 @@ public async Task CheckForUpdatesAsync()
102102
if (_updatePackages is not null && _updatePackages.Count > 0)
103103
{
104104
App.Logger.LogInformation("STORE: Update found.");
105-
IsUpdateAvailable = true;
105+
106+
MainWindow.Instance.DispatcherQueue.TryEnqueue(() =>
107+
{
108+
IsUpdateAvailable = true;
109+
});
106110
}
107111
}
108112

0 commit comments

Comments
 (0)