mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-30 13:51:53 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user