2024-03-17 18:37:06 -07:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
using Avalonia.Collections;
|
2024-02-05 23:08:37 -08:00
|
|
|
|
using Avalonia.Threading;
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
namespace SourceGit.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public class AssumeUnchangedManager
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
public AvaloniaList<string> Files { get; private set; }
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public AssumeUnchangedManager(string repo)
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
_repo = repo;
|
|
|
|
|
Files = new AvaloniaList<string>();
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
Task.Run(() =>
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
var collect = new Commands.AssumeUnchanged(_repo).View();
|
2024-03-17 18:37:06 -07:00
|
|
|
|
Dispatcher.UIThread.Invoke(() =>
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
Files.AddRange(collect);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public void Remove(object param)
|
|
|
|
|
{
|
|
|
|
|
if (param is string file)
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
new Commands.AssumeUnchanged(_repo).Remove(file);
|
|
|
|
|
Files.Remove(file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
private readonly string _repo;
|
2024-02-05 23:08:37 -08:00
|
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
|
}
|