Admin mode WIP
This commit is contained in:
@@ -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, _) =>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user