-
Notifications
You must be signed in to change notification settings - Fork 204
/
Copy pathLFSTrackCustomPattern.cs
46 lines (39 loc) · 1.21 KB
/
LFSTrackCustomPattern.cs
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
43
44
45
46
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
namespace SourceGit.ViewModels
{
public class LFSTrackCustomPattern : Popup
{
[Required(ErrorMessage = "LFS track pattern is required!!!")]
public string Pattern
{
get => _pattern;
set => SetProperty(ref _pattern, value, true);
}
public bool IsFilename
{
get;
set;
} = false;
public LFSTrackCustomPattern(Repository repo)
{
_repo = repo;
}
public override Task<bool> Sure()
{
_repo.SetWatcherEnabled(false);
ProgressDescription = "Adding custom LFS tracking pattern ...";
var log = _repo.CreateLog("LFS Add Custom Pattern");
Use(log);
return Task.Run(() =>
{
var succ = new Commands.LFS(_repo.FullPath).Track(_pattern, IsFilename, log);
log.Complete();
CallUIThread(() => _repo.SetWatcherEnabled(true));
return succ;
});
}
private readonly Repository _repo = null;
private string _pattern = string.Empty;
}
}