Admin mode WIP

This commit is contained in:
2023-07-26 10:24:22 +02:00
parent ba1210b2c4
commit 0c49071a3b
46 changed files with 695 additions and 55 deletions

View File

@@ -15,7 +15,6 @@ public class Tab : ITab
{
private readonly ITimelessContentProvider _timelessContentProvider;
private readonly ITabEvents _tabEvents;
private readonly IRefreshSmoothnessCalculator _refreshSmoothnessCalculator;
private readonly DeclarativeProperty<IContainer?> _currentLocation = new(null);
private readonly BehaviorSubject<IContainer?> _currentLocationForced = new(null);
private readonly DeclarativeProperty<AbsolutePath?> _currentRequestItem = new(null);
@@ -38,7 +37,6 @@ public class Tab : ITab
{
_timelessContentProvider = timelessContentProvider;
_tabEvents = tabEvents;
_refreshSmoothnessCalculator = refreshSmoothnessCalculator;
_currentPointInTime = null!;
_timelessContentProvider.CurrentPointInTime.Subscribe(p => _currentPointInTime = p);
@@ -54,7 +52,8 @@ public class Tab : ITab
return Task.CompletedTask;
});
CurrentItems = CurrentLocation.Map((container, _) =>
CurrentItems = CurrentLocation
.Map((container, _) =>
{
var items = container is null
? (ObservableCollection<IItem>?) null
@@ -63,7 +62,7 @@ public class Tab : ITab
}
);
CurrentSelectedItem = DeclarativePropertyHelpers.CombineLatest(
CurrentItems.Watch<ObservableCollection<IItem>, IItem>(),
_currentRequestItem.DistinctUntilChanged(),
@@ -77,8 +76,8 @@ public class Tab : ITab
CurrentSelectedItem.Subscribe((v) =>
{
_refreshSmoothnessCalculator.RegisterChange();
_refreshSmoothnessCalculator.RecalculateSmoothness();
refreshSmoothnessCalculator.RegisterChange();
refreshSmoothnessCalculator.RecalculateSmoothness();
});
CurrentSelectedItem.Subscribe(async (s, _) =>

View File

@@ -10,4 +10,8 @@
<ProjectReference Include="..\FileTime.Core.Abstraction\FileTime.Core.Abstraction.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
</ItemGroup>
</Project>

View File

@@ -1,15 +1,18 @@
using FileTime.Core.Command;
using Microsoft.Extensions.Logging;
namespace FileTime.Core.Timeline;
public class LocalCommandExecutor : ILocalCommandExecutor
{
private readonly ICommandRunner _commandRunner;
private readonly ILogger<LocalCommandExecutor> _logger;
public event EventHandler<ICommand>? CommandFinished;
public LocalCommandExecutor(ICommandRunner commandRunner)
public LocalCommandExecutor(ICommandRunner commandRunner, ILogger<LocalCommandExecutor> logger)
{
_commandRunner = commandRunner;
_logger = logger;
}
public void ExecuteCommand(ICommand command)
@@ -27,7 +30,10 @@ public class LocalCommandExecutor : ILocalCommandExecutor
{
await _commandRunner.RunCommandAsync(context.Command);
}
catch (Exception ex) { }
catch (Exception ex)
{
_logger.LogError(ex, "Error executing command {Command}", context.Command.GetType().Name);
}
CommandFinished?.Invoke(this, context.Command);
}