-
Notifications
You must be signed in to change notification settings - Fork 386
Expand file tree
/
Copy pathAssumeUnchangedManager.cs
More file actions
42 lines (35 loc) · 1.15 KB
/
AssumeUnchangedManager.cs
File metadata and controls
42 lines (35 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Threading.Tasks;
using Avalonia.Collections;
using Avalonia.Threading;
namespace SourceGit.ViewModels
{
public class AssumeUnchangedManager
{
public AvaloniaList<string> Files { get; private set; }
public AssumeUnchangedManager(Repository repo)
{
_repo = repo;
Files = new AvaloniaList<string>();
Task.Run(async () =>
{
var collect = await new Commands.QueryAssumeUnchangedFiles(_repo.FullPath)
.GetResultAsync()
.ConfigureAwait(false);
Dispatcher.UIThread.Post(() => Files.AddRange(collect));
});
}
public async Task RemoveAsync(string file)
{
if (!string.IsNullOrEmpty(file))
{
var log = _repo.CreateLog("Remove Assume Unchanged File");
await new Commands.AssumeUnchanged(_repo.FullPath, file, false)
.Use(log)
.ExecAsync();
log.Complete();
Files.Remove(file);
}
}
private readonly Repository _repo;
}
}