Skip to content

Commit 9d75f71

Browse files
committed
#32 - Make IBundleProvider.IsAvailable asynchronous so UI won't freeze for remote filesystem.
1 parent 768d850 commit 9d75f71

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/GitExtensions.BundleBackuper/Services/FileSystemBundleProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ internal FileSystemBundleProvider(PluginSettings settings)
1818
this.settings = settings;
1919
}
2020

21-
public bool IsAvailable()
22-
=> Directory.Exists(settings.BackupPath);
21+
public Task<bool> IsAvailableAsync()
22+
=> Task.Run(() => Directory.Exists(settings.BackupPath));
2323

2424
public Task<IReadOnlyCollection<Bundle>> EnumerateAsync()
2525
{

src/GitExtensions.BundleBackuper/Services/IBundleProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public interface IBundleProvider
1515
/// Returns <c>true</c> if storage is available for reading.
1616
/// </summary>
1717
/// <returns><c>true</c> if storage is available for reading.</returns>
18-
bool IsAvailable();
18+
Task<bool> IsAvailableAsync();
1919

2020
/// <summary>
2121
/// Enumerates all currently available backup bundles.

src/GitExtensions.BundleBackuper/UI/BundleListMenuItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private async void OnDropDownOpening(object sender, EventArgs e)
4444
if (DropDown.Items.Count == 3)
4545
DropDown.Items.RemoveAt(2);
4646

47-
if (!provider.IsAvailable())
47+
if (!await provider.IsAvailableAsync())
4848
{
4949
SetItemsEnabled(false);
5050
return;

0 commit comments

Comments
 (0)