SMB, GUI imput handler, ThreadSafe SMB

This commit is contained in:
2022-02-01 13:03:00 +01:00
parent c2dcb49016
commit 9824184d90
10 changed files with 265 additions and 48 deletions

View File

@@ -54,7 +54,10 @@ namespace FileTime.Core.Components
IItem? itemToSelect = null;
if (value != null)
{
itemToSelect = (await _currentLocation.GetItems())?.FirstOrDefault(i => i.FullName == value?.FullName);
itemToSelect = (await _currentLocation.GetItems())?.FirstOrDefault(i =>
i.FullName == null && value?.FullName == null
? i.Name == value?.Name
: i.FullName == value?.FullName);
if (itemToSelect == null) throw new IndexOutOfRangeException("Provided item does not exists in the current container.");
}
@@ -123,7 +126,7 @@ namespace FileTime.Core.Components
private async Task HandleCurrentLocationRefresh(object? sender, AsyncEventArgs e)
{
var currentSelectedName = (await GetCurrentSelectedItem())?.FullName ?? (await GetItemByLastPath()).FullName;
var currentSelectedName = (await GetCurrentSelectedItem())?.FullName ?? (await GetItemByLastPath())?.FullName;
var currentLocationItems = (await (await GetCurrentLocation()).GetItems())!;
if (currentSelectedName != null)
{

View File

@@ -0,0 +1,9 @@
namespace FileTime.Core.Interactions
{
public class BasicInputHandler : IInputInterface
{
public Func<IEnumerable<InputElement>, Task<string?[]>>? InputHandler { get; set; }
public async Task<string?[]> ReadInputs(IEnumerable<InputElement> fields) =>
InputHandler != null ? await InputHandler.Invoke(fields) : throw new NotImplementedException(nameof(InputHandler) + " is not set");
}
}