Item ordering

This commit is contained in:
2023-07-28 01:38:53 +02:00
parent 27ebb1efa8
commit 0db7949037
13 changed files with 155 additions and 28 deletions

View File

@@ -0,0 +1,9 @@
namespace FileTime.App.Core.Models;
public enum ItemOrdering
{
Name,
NameDesc,
LastModifyDate,
LastModifyDateDesc,
}

View File

@@ -25,7 +25,7 @@ public class IdentifiableSearchCommand : SearchCommand, IIdentifiableUserCommand
public static readonly IdentifiableSearchCommand SearchByNameContains =
new(null, SearchType.NameContains, SearchByNameContainsCommandName);
public IdentifiableSearchCommand(
private IdentifiableSearchCommand(
string? searchText,
SearchType searchType,
string commandId)

View File

@@ -0,0 +1,33 @@
using FileTime.App.Core.Models;
namespace FileTime.App.Core.UserCommand;
public class SortItemsCommand : IIdentifiableUserCommand
{
public const string OrderByNameCommandName = "order_by_name";
public const string OrderByNameDescCommandName = "order_by_name_desc";
public const string OrderByDateCommandName = "order_by_date";
public const string OrderByDateDescCommandName = "order_by_date_desc";
public static readonly SortItemsCommand OrderByNameCommand =
new(OrderByNameCommandName, ItemOrdering.Name);
public static readonly SortItemsCommand OrderByNameDescCommand =
new(OrderByNameDescCommandName, ItemOrdering.NameDesc);
public static readonly SortItemsCommand OrderByDateCommand =
new(OrderByDateCommandName, ItemOrdering.LastModifyDate);
public static readonly SortItemsCommand OrderByDateDescCommand =
new(OrderByDateDescCommandName, ItemOrdering.LastModifyDateDesc);
private SortItemsCommand(string userCommandId, ItemOrdering ordering)
{
UserCommandID = userCommandId;
Ordering = ordering;
}
public string UserCommandID { get; }
public ItemOrdering Ordering { get; }
}

View File

@@ -2,6 +2,7 @@
using System.Collections.ObjectModel;
using DeclarativeProperty;
using DynamicData;
using FileTime.App.Core.Models;
using FileTime.Core.Models;
using FileTime.Core.Services;
using InitableService;
@@ -20,6 +21,7 @@ public interface ITabViewModel : IInitable<ITab, int>, IDisposable
IObservable<IChangeSet<FullName>> MarkedItems { get; }
IDeclarativeProperty<ObservableCollection<IItemViewModel>> SelectedsChildren { get; }
IDeclarativeProperty<ObservableCollection<IItemViewModel>> ParentsChildren { get; }
DeclarativeProperty<ItemOrdering?> Ordering { get; }
void ClearMarkedItems();
void RemoveMarkedItem(FullName fullName);