Order by file name
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using System.Reactive.Linq;
|
using System.Reactive.Linq;
|
||||||
using DynamicData;
|
using DynamicData;
|
||||||
|
using DynamicData.Binding;
|
||||||
using FileTime.App.Core.Extensions;
|
using FileTime.App.Core.Extensions;
|
||||||
using FileTime.App.Core.Models;
|
using FileTime.App.Core.Models;
|
||||||
using FileTime.App.Core.Models.Enums;
|
using FileTime.App.Core.Models.Enums;
|
||||||
@@ -80,6 +81,7 @@ public partial class TabViewModel : ITabViewModel
|
|||||||
|
|
||||||
CurrentItems = tab.CurrentItems
|
CurrentItems = tab.CurrentItems
|
||||||
.Select(items => items?.Transform(i => MapItemToViewModel(i, ItemViewModelType.Main)))
|
.Select(items => items?.Transform(i => MapItemToViewModel(i, ItemViewModelType.Main)))
|
||||||
|
.Select(items => items?.Sort(SortItems()))
|
||||||
.Publish(null)
|
.Publish(null)
|
||||||
.RefCount();
|
.RefCount();
|
||||||
|
|
||||||
@@ -134,8 +136,11 @@ public partial class TabViewModel : ITabViewModel
|
|||||||
.Select(c => c.Container!.Items)
|
.Select(c => c.Container!.Items)
|
||||||
.Switch()
|
.Switch()
|
||||||
.Select(i =>
|
.Select(i =>
|
||||||
i?.TransformAsync(MapItem)
|
i
|
||||||
.Transform(i => MapItemToViewModel(i, ItemViewModelType.SelectedChild))),
|
?.TransformAsync(MapItem)
|
||||||
|
.Transform(i => MapItemToViewModel(i, ItemViewModelType.SelectedChild))
|
||||||
|
.Sort(SortItems())
|
||||||
|
),
|
||||||
currentSelectedItemThrottled
|
currentSelectedItemThrottled
|
||||||
.Where(c => c is null or not IContainerViewModel)
|
.Where(c => c is null or not IContainerViewModel)
|
||||||
.Select(_ => (IObservable<IChangeSet<IItemViewModel, string>>?)null)
|
.Select(_ => (IObservable<IChangeSet<IItemViewModel, string>>?)null)
|
||||||
@@ -162,8 +167,11 @@ public partial class TabViewModel : ITabViewModel
|
|||||||
.Select(p => p.Items)
|
.Select(p => p.Items)
|
||||||
.Switch()
|
.Switch()
|
||||||
.Select(items =>
|
.Select(items =>
|
||||||
items?.TransformAsync(MapItem)
|
items
|
||||||
.Transform(i => MapItemToViewModel(i, ItemViewModelType.Parent))),
|
?.TransformAsync(MapItem)
|
||||||
|
.Transform(i => MapItemToViewModel(i, ItemViewModelType.Parent))
|
||||||
|
.Sort(SortItems())
|
||||||
|
),
|
||||||
parentThrottled
|
parentThrottled
|
||||||
.Where(p => p is null)
|
.Where(p => p is null)
|
||||||
.Select(_ => (IObservable<IChangeSet<IItemViewModel, string>>?)null)
|
.Select(_ => (IObservable<IChangeSet<IItemViewModel, string>>?)null)
|
||||||
@@ -186,6 +194,10 @@ public partial class TabViewModel : ITabViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static SortExpressionComparer<IItemViewModel> SortItems()
|
||||||
|
//TODO: Order
|
||||||
|
=> SortExpressionComparer<IItemViewModel>.Ascending(i => i.DisplayNameText ?? "");
|
||||||
|
|
||||||
private static async Task<IItem> MapItem(AbsolutePath item)
|
private static async Task<IItem> MapItem(AbsolutePath item)
|
||||||
=> await item.ResolveAsync(forceResolve: true,
|
=> await item.ResolveAsync(forceResolve: true,
|
||||||
itemInitializationSettings: new ItemInitializationSettings(true));
|
itemInitializationSettings: new ItemInitializationSettings(true));
|
||||||
|
|||||||
Reference in New Issue
Block a user