feature: async (#1492)

* Async command methods
* Async `Task.Run` where possible
* Remove redundant `Task.Run` in `Sure` methods
* Remove leftover braces and reformat
* Async event handlers as needed
This commit is contained in:
Nathan Baulch
2025-07-02 23:16:06 +10:00
committed by leo
parent 3b8dcd72ee
commit 463e304491
134 changed files with 2333 additions and 1549 deletions

View File

@@ -40,7 +40,7 @@ namespace SourceGit.ViewModels
return ValidationResult.Success;
}
public override Task<bool> Sure()
public override async Task<bool> Sure()
{
_repo.SetWatcherEnabled(false);
ProgressDescription = "Adding submodule...";
@@ -59,14 +59,11 @@ namespace SourceGit.ViewModels
relativePath = Path.GetFileName(_url);
}
return Task.Run(() =>
{
var succ = new Commands.Submodule(_repo.FullPath).Use(log).Add(_url, relativePath, Recursive);
log.Complete();
var succ = await new Commands.Submodule(_repo.FullPath).Use(log).AddAsync(_url, relativePath, Recursive);
log.Complete();
CallUIThread(() => _repo.SetWatcherEnabled(true));
return succ;
});
await CallUIThreadAsync(() => _repo.SetWatcherEnabled(true));
return succ;
}
private readonly Repository _repo = null;