Added search pivot
This commit is contained in:
@@ -57,8 +57,8 @@ namespace Wino.Mail.ViewModels
|
|||||||
|
|
||||||
public WinoMailCollection MailCollection { get; } = new WinoMailCollection();
|
public WinoMailCollection MailCollection { get; } = new WinoMailCollection();
|
||||||
|
|
||||||
public ObservableCollection<MailItemViewModel> SelectedItems { get; set; } = new ObservableCollection<MailItemViewModel>();
|
public ObservableCollection<MailItemViewModel> SelectedItems { get; set; } = [];
|
||||||
public ObservableCollection<FolderPivotViewModel> PivotFolders { get; set; } = new ObservableCollection<FolderPivotViewModel>();
|
public ObservableCollection<FolderPivotViewModel> PivotFolders { get; set; } = [];
|
||||||
|
|
||||||
private readonly SemaphoreSlim listManipulationSemepahore = new SemaphoreSlim(1);
|
private readonly SemaphoreSlim listManipulationSemepahore = new SemaphoreSlim(1);
|
||||||
private CancellationTokenSource listManipulationCancellationTokenSource = new CancellationTokenSource();
|
private CancellationTokenSource listManipulationCancellationTokenSource = new CancellationTokenSource();
|
||||||
@@ -99,7 +99,7 @@ namespace Wino.Mail.ViewModels
|
|||||||
private FilterOption _selectedFilterOption;
|
private FilterOption _selectedFilterOption;
|
||||||
private SortingOption _selectedSortingOption;
|
private SortingOption _selectedSortingOption;
|
||||||
|
|
||||||
// Indicates state when folder is initializing. It can happen after folder navigation, search or filter change applied.
|
// Indicates state when folder is initializing. It can happen after folder navigation, search or filter change applied or loading more items.
|
||||||
[ObservableProperty]
|
[ObservableProperty]
|
||||||
[NotifyPropertyChangedFor(nameof(IsEmpty))]
|
[NotifyPropertyChangedFor(nameof(IsEmpty))]
|
||||||
[NotifyPropertyChangedFor(nameof(IsCriteriaFailed))]
|
[NotifyPropertyChangedFor(nameof(IsCriteriaFailed))]
|
||||||
@@ -471,15 +471,32 @@ namespace Wino.Mail.ViewModels
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(SearchQuery) && IsInSearchMode)
|
if (string.IsNullOrEmpty(SearchQuery) && IsInSearchMode)
|
||||||
{
|
{
|
||||||
|
UpdateFolderPivots();
|
||||||
IsInSearchMode = false;
|
IsInSearchMode = false;
|
||||||
await InitializeFolderAsync();
|
await InitializeFolderAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(SearchQuery))
|
if (!string.IsNullOrEmpty(SearchQuery))
|
||||||
{
|
{
|
||||||
|
|
||||||
IsInSearchMode = true;
|
IsInSearchMode = true;
|
||||||
|
CreateSearchPivot();
|
||||||
await InitializeFolderAsync();
|
await InitializeFolderAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CreateSearchPivot()
|
||||||
|
{
|
||||||
|
PivotFolders.Clear();
|
||||||
|
var isFocused = SelectedFolderPivot?.IsFocused;
|
||||||
|
SelectedFolderPivot = null;
|
||||||
|
|
||||||
|
if (ActiveFolder == null) return;
|
||||||
|
|
||||||
|
PivotFolders.Add(new FolderPivotViewModel("Results", isFocused));
|
||||||
|
|
||||||
|
// This will trigger refresh.
|
||||||
|
SelectedFolderPivot = PivotFolders.FirstOrDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[RelayCommand]
|
[RelayCommand]
|
||||||
|
|||||||
Reference in New Issue
Block a user