Tab restore

This commit is contained in:
2022-05-24 17:02:36 +02:00
parent dcff003c28
commit 8167909781
16 changed files with 339 additions and 11 deletions

View File

@@ -5,13 +5,23 @@ namespace FileTime.GuiApp.Services;
public class LifecycleService
{
private readonly IEnumerable<IExitHandler> _exitHandlers;
private readonly IEnumerable<IStartupHandler> _startupHandlers;
public LifecycleService(IEnumerable<IStartupHandler> startupHandlers, IEnumerable<IExitHandler> exitHandlers)
{
_exitHandlers = exitHandlers;
_startupHandlers = startupHandlers;
}
public async Task Exit()
public async Task InitStartupHandlersAsync()
{
foreach (var startupHandler in _startupHandlers)
{
await startupHandler.InitAsync();
}
}
public async Task ExitAsync()
{
foreach (var exitHandler in _exitHandlers)
{

View File

@@ -38,7 +38,7 @@ public class RootDriveInfoService : IStartupHandler
{
var containerPath = localContentProvider.GetNativePath(i.Path).Path;
var drivePath = d.Name.TrimEnd(Path.DirectorySeparatorChar);
return containerPath == drivePath
return containerPath == drivePath
|| (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && containerPath == "/" && d.Name == "/");
})))
.Filter(t => t.Drive is not null);
@@ -68,4 +68,6 @@ public class RootDriveInfoService : IStartupHandler
_rootDrives.AddRange(drives);
}
}
public Task InitAsync() => Task.CompletedTask;
}