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 CreateGroup : Popup
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
[Required(ErrorMessage = "Group 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 CreateGroup(RepositoryNode parent)
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
_parent = parent;
|
|
|
|
|
View = new Views.CreateGroup() { DataContext = this };
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public override Task<bool> Sure()
|
|
|
|
|
{
|
|
|
|
|
Preference.AddNode(new RepositoryNode()
|
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
Id = Guid.NewGuid().ToString(),
|
|
|
|
|
Name = _name,
|
|
|
|
|
IsRepository = false,
|
|
|
|
|
IsExpanded = false,
|
|
|
|
|
}, _parent);
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
private readonly RepositoryNode _parent = null;
|
2024-02-05 23:08:37 -08:00
|
|
|
|
private string _name = string.Empty;
|
|
|
|
|
}
|
2024-03-17 18:37:06 -07:00
|
|
|
|
}
|