2024-02-05 23:08:37 -08:00
|
|
|
|
using System;
|
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
namespace SourceGit.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public class EditRepositoryNode : Popup
|
|
|
|
|
{
|
|
|
|
|
public RepositoryNode Node
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
get => _node;
|
|
|
|
|
set => SetProperty(ref _node, value);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public string Id
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
get => _id;
|
|
|
|
|
set => SetProperty(ref _id, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Required(ErrorMessage = "Name is required!")]
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public string Name
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
get => _name;
|
|
|
|
|
set => SetProperty(ref _name, value, true);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public int Bookmark
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
get => _bookmark;
|
|
|
|
|
set => SetProperty(ref _bookmark, value);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public bool IsRepository
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
get => _isRepository;
|
|
|
|
|
set => SetProperty(ref _isRepository, value);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public EditRepositoryNode(RepositoryNode node)
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
_node = node;
|
|
|
|
|
_id = node.Id;
|
|
|
|
|
_name = node.Name;
|
|
|
|
|
_isRepository = node.IsRepository;
|
|
|
|
|
_bookmark = node.Bookmark;
|
|
|
|
|
|
|
|
|
|
View = new Views.EditRepositoryNode() { DataContext = this };
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public override Task<bool> Sure()
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
_node.Name = _name;
|
|
|
|
|
_node.Bookmark = _bookmark;
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
private RepositoryNode _node = null;
|
2024-02-05 23:08:37 -08:00
|
|
|
|
private string _id = string.Empty;
|
|
|
|
|
private string _name = string.Empty;
|
|
|
|
|
private bool _isRepository = false;
|
|
|
|
|
private int _bookmark = 0;
|
|
|
|
|
}
|
2024-03-17 18:37:06 -07:00
|
|
|
|
}
|