Using CancellationToken

This commit is contained in:
2022-02-04 00:17:03 +01:00
parent 3f8309dc0f
commit 2e832f72d2
23 changed files with 1509 additions and 147 deletions

View File

@@ -51,12 +51,12 @@ namespace FileTime.Providers.Smb
public async Task<IReadOnlyList<IItem>?> GetItems(CancellationToken token = default)
{
if (_shares == null) await Refresh();
if (_shares == null) await RefreshAsync();
return _shares;
}
public async Task<IReadOnlyList<IContainer>?> GetContainers(CancellationToken token = default)
{
if (_shares == null) await Refresh();
if (_shares == null) await RefreshAsync();
return _shares;
}
public Task<IReadOnlyList<IElement>?> GetElements(CancellationToken token = default)
@@ -91,7 +91,7 @@ namespace FileTime.Providers.Smb
throw new NotImplementedException();
}
public async Task Refresh()
public async Task RefreshAsync(CancellationToken token = default)
{
List<string> shares = await _smbClientContext.RunWithSmbClientAsync((client) => client.ListShares(out var status));