Skip to content

Commit

Permalink
fix: 解决文件夹问题, 但只有一部分, 属实难绷
Browse files Browse the repository at this point in the history
  • Loading branch information
SlimeNull committed Mar 24, 2024
1 parent 10744e4 commit cd56c26
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private async Task<LoadMoreItemsResult> LoadMoreItemsAsync(CancellationToken Can
return new LoadMoreItemsResult { Count = LoadCounter };
}

public MailIncrementalLoadingObservableCollection(Func<MailIncrementalLoadingObservableCollection, uint, CancellationToken, IAsyncEnumerable<MailMessage>> FetchDataDelegate, uint TotalItemCount, uint MinIncrementalLoadingStep = 30)
public MailIncrementalLoadingObservableCollection(Func<MailIncrementalLoadingObservableCollection, uint, CancellationToken, IAsyncEnumerable<MailMessage>> FetchDataDelegate, uint TotalItemCount, uint MinIncrementalLoadingStep = 18)
{
this.TotalItemCount = TotalItemCount;
this.MinIncrementalLoadingStep = MinIncrementalLoadingStep;
Expand Down
11 changes: 9 additions & 2 deletions src/MicaApps.Mail.UWP/Pages/MailFolderDetailsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private async Task InitializeDataFromMailFolderAsync(MailFolder MailFolder, bool

}, Convert.ToUInt32(MailFolder.TotalItemCount));

await _previewSource.LoadMoreItemsAsync(30);
await _previewSource.LoadMoreItemsAsync(18);

if (_previewSource.Count == 0)
{
Expand Down Expand Up @@ -394,7 +394,14 @@ private void CreateMail_Click(object sender, RoutedEventArgs e)
_previewSource.Insert(0, NewEmptyModel);
DetailsView.SelectedItem = NewEmptyModel;

//EditMail.CreateEditWindow(new EditMailOption {Model = model,EditMailType = EditMailType.Send });
// 这段代码是用来创建一个“编辑邮件”的窗口的
// 但是编辑邮件的逻辑仍需重写 故在此先注释掉

// EditMail.CreateEditWindow(new EditMailOption
// {
// Model = NewEmptyModel,
// EditMailType = EditMailType.Send
// });
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/MicaApps.Mail.UWP/Services/LocalCacheService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,11 @@ public List<MailMessage> QueryMessage(LoadMailMessageOption option)
.Query()
.Where(msg => msg.FolderId == option.FolderId)
.Where(msg => msg.InferenceClassification == tab)
// sort before paging
.OrderByDescending(x => x.SentTime)
.Skip(option.StartIndex)
.Limit(option.LoadCount)
.ToEnumerable()
.OrderByDescending(x => x.SentTime)
.ToList();
}

Expand Down
5 changes: 3 additions & 2 deletions src/MicaApps.Mail.UWP/Services/OutlookService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ private async Task DefaultFolderTaskAsync(string name,
public override async IAsyncEnumerable<Models.MailFolder> GetMailSuperFoldersAsync(
[EnumeratorCancellation] CancellationToken CancelToken = default)
{
//
await LoadSuperMailFolderList(CancelToken);

var folderData = _liteDatabaseService.MailFolders
.Query()
.Where((x) => x.Type == MailFolderType.Inbox)
Expand All @@ -210,8 +213,6 @@ await Task.WhenAll(DefaultFolderTaskAsync("inbox", CancelToken),
MailFoldersTree.Add(mailFolderData);
yield return mailFolderData;
}

await LoadSuperMailFolderList(CancelToken);
}

private async Task LoadSuperMailFolderList(CancellationToken CancelToken)
Expand Down

0 comments on commit cd56c26

Please sign in to comment.