mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-11-01 13:13:21 -07:00
74 lines
2.1 KiB
C#
74 lines
2.1 KiB
C#
|
using Avalonia.Collections;
|
|||
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|||
|
using System.Text.Json.Serialization;
|
|||
|
|
|||
|
namespace SourceGit.ViewModels {
|
|||
|
public class RepositoryNode : ObservableObject {
|
|||
|
public string Id {
|
|||
|
get => _id;
|
|||
|
set => SetProperty(ref _id, value);
|
|||
|
}
|
|||
|
|
|||
|
public string Name {
|
|||
|
get => _name;
|
|||
|
set => SetProperty(ref _name, value);
|
|||
|
}
|
|||
|
|
|||
|
public int Bookmark {
|
|||
|
get => _bookmark;
|
|||
|
set => SetProperty(ref _bookmark, value);
|
|||
|
}
|
|||
|
|
|||
|
public bool IsRepository {
|
|||
|
get => _isRepository;
|
|||
|
set => SetProperty(ref _isRepository, value);
|
|||
|
}
|
|||
|
|
|||
|
public bool IsExpanded {
|
|||
|
get => _isExpanded;
|
|||
|
set => SetProperty(ref _isExpanded, value);
|
|||
|
}
|
|||
|
|
|||
|
[JsonIgnore]
|
|||
|
public bool IsVisible {
|
|||
|
get => _isVisible;
|
|||
|
set => SetProperty(ref _isVisible, value);
|
|||
|
}
|
|||
|
|
|||
|
public AvaloniaList<RepositoryNode> SubNodes {
|
|||
|
get => _subNodes;
|
|||
|
set => SetProperty(ref _subNodes, value);
|
|||
|
}
|
|||
|
|
|||
|
public void Edit() {
|
|||
|
if (PopupHost.CanCreatePopup()) PopupHost.ShowPopup(new EditRepositoryNode(this));
|
|||
|
}
|
|||
|
|
|||
|
public void AddSubFolder() {
|
|||
|
if (PopupHost.CanCreatePopup()) PopupHost.ShowPopup(new CreateGroup(this));
|
|||
|
}
|
|||
|
|
|||
|
public void OpenInFileManager() {
|
|||
|
if (!IsRepository) return;
|
|||
|
Native.OS.OpenInFileManager(_id);
|
|||
|
}
|
|||
|
|
|||
|
public void OpenTerminal() {
|
|||
|
if (!IsRepository) return;
|
|||
|
Native.OS.OpenTerminal(_id);
|
|||
|
}
|
|||
|
|
|||
|
public void Delete() {
|
|||
|
if (PopupHost.CanCreatePopup()) PopupHost.ShowPopup(new DeleteRepositoryNode(this));
|
|||
|
}
|
|||
|
|
|||
|
private string _id = string.Empty;
|
|||
|
private string _name = string.Empty;
|
|||
|
private bool _isRepository = false;
|
|||
|
private int _bookmark = 0;
|
|||
|
private bool _isExpanded = false;
|
|||
|
private bool _isVisible = true;
|
|||
|
private AvaloniaList<RepositoryNode> _subNodes = new AvaloniaList<RepositoryNode>();
|
|||
|
}
|
|||
|
}
|