Graph rate limit handler.

This commit is contained in:
Burak Kaan Köse
2025-10-31 19:53:48 +01:00
parent 37b8a382a8
commit 4d0d2ff099
5 changed files with 175 additions and 38 deletions
+2 -16
View File
@@ -792,11 +792,7 @@ public partial class MailListPageViewModel : MailBaseViewModel,
if (ActiveFolder == null)
return;
await ExecuteUIThread(() => {
IsInitializingFolder = true;
// Show initial loading progress
UpdateBarMessage(InfoBarMessageType.Information, ActiveFolder.FolderName, "Loading emails...");
});
await ExecuteUIThread(() => { IsInitializingFolder = true; });
// Folder is changed during initialization.
// Just cancel the existing one and wait for new initialization.
@@ -887,22 +883,12 @@ public partial class MailListPageViewModel : MailBaseViewModel,
if (!listManipulationCancellationTokenSource.IsCancellationRequested)
{
// Update progress: Creating view models
await ExecuteUIThread(() => {
UpdateBarMessage(InfoBarMessageType.Information, ActiveFolder.FolderName, $"Processing {items.Count} emails...");
});
// Here they are already threaded if needed.
// We don't need to insert them one by one.
// Just create VMs and do bulk insert.
var viewModels = await PrepareMailViewModelsAsync(items, cancellationToken).ConfigureAwait(false);
// Update progress: Adding to collection
await ExecuteUIThread(() => {
UpdateBarMessage(InfoBarMessageType.Information, ActiveFolder.FolderName, "Finalizing...");
});
await MailCollection.AddRangeAsync(viewModels, clearIdCache: true);
await ExecuteUIThread(() =>
@@ -937,7 +923,7 @@ public partial class MailListPageViewModel : MailBaseViewModel,
OnPropertyChanged(nameof(CanSynchronize));
NotifyItemFoundState();
// Clear the loading message after completion
IsBarOpen = false;
});