mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-26 21:17:20 -08:00
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
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;
|
|
View = new Views.LFSTrackCustomPattern() { DataContext = this };
|
|
}
|
|
|
|
public override Task<bool> Sure()
|
|
{
|
|
_repo.SetWatcherEnabled(false);
|
|
ProgressDescription = "Adding custom LFS tracking pattern ...";
|
|
|
|
return Task.Run(() =>
|
|
{
|
|
var succ = new Commands.LFS(_repo.FullPath).Track(_pattern, IsFilename);
|
|
CallUIThread(() => _repo.SetWatcherEnabled(true));
|
|
return succ;
|
|
});
|
|
}
|
|
|
|
private readonly Repository _repo = null;
|
|
private string _pattern = string.Empty;
|
|
}
|
|
}
|