Search by regex, modal Enter fixes

This commit is contained in:
2023-07-31 14:07:52 +02:00
parent a537277546
commit bc31b71130
38 changed files with 301 additions and 53 deletions

View File

@@ -0,0 +1,32 @@
using FileTime.Core.Models;
namespace FileTime.App.Core.Exceptions;
public enum ItemNotFoundExceptionType
{
Raw,
FullName,
NativePath
}
public class ItemNotFoundException : Exception
{
public string Path { get; }
public ItemNotFoundExceptionType Type { get; } = ItemNotFoundExceptionType.Raw;
public ItemNotFoundException(string path)
{
Path = path;
}
public ItemNotFoundException(FullName path)
{
Path = path.Path;
Type = ItemNotFoundExceptionType.FullName;
}
public ItemNotFoundException(NativePath path)
{
Path = path.Path;
Type = ItemNotFoundExceptionType.NativePath;
}
}

View File

@@ -1,6 +1,7 @@
using System.Reactive.Subjects;
using FileTime.App.Core.Models;
using FileTime.Core.Interactions;
using FileTime.Core.Models;
namespace FileTime.App.Core.Interactions;

View File

@@ -1,3 +0,0 @@
namespace FileTime.App.Core.Models;
public record ItemNamePart(string Text, bool IsSpecial = false);

View File

@@ -1,4 +1,5 @@
using FileTime.App.Core.Models;
using FileTime.Core.Models;
namespace FileTime.App.Core.Services;

View File

@@ -21,10 +21,14 @@ public class SearchCommand : IUserCommand
public sealed class IdentifiableSearchCommand : SearchCommand, IIdentifiableUserCommand
{
public const string SearchByNameContainsCommandName = "search_name_contains";
public const string SearchByRegexCommandName = "search_name_regex";
public static readonly IdentifiableSearchCommand SearchByNameContains =
new(null, SearchType.NameContains, SearchByNameContainsCommandName, "Search by name");
public static readonly IdentifiableSearchCommand SearchByRegex =
new(null, SearchType.NameRegex, SearchByRegexCommandName, "Search by name (Regex)");
private IdentifiableSearchCommand(
string? searchText,
SearchType searchType,

View File

@@ -10,7 +10,7 @@ public interface IAppState
ReadOnlyObservableCollection<ITabViewModel> Tabs { get; }
IObservable<ITabViewModel?> SelectedTab { get; }
IObservable<string?> SearchText { get; }
IObservable<ViewMode> ViewMode { get; }
IDeclarativeProperty<ViewMode> ViewMode { get; }
DeclarativeProperty<string?> RapidTravelText { get; }
ITabViewModel? CurrentSelectedTab { get; }
ITimelineViewModel TimelineViewModel { get; }
@@ -18,6 +18,6 @@ public interface IAppState
void AddTab(ITabViewModel tabViewModel);
void RemoveTab(ITabViewModel tabViewModel);
void SetSearchText(string? searchText);
void SwitchViewMode(ViewMode newViewMode);
Task SwitchViewModeAsync(ViewMode newViewMode);
void SetSelectedTab(ITabViewModel tabToSelect);
}

View File

@@ -1,5 +1,4 @@
using DeclarativeProperty;
using FileTime.App.Core.Models;
using FileTime.App.Core.Models.Enums;
using FileTime.Core.Models;
using InitableService;