forked from sourcegit-scm/sourcegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepositoryNode.cs
More file actions
73 lines (60 loc) · 2.1 KB
/
Copy pathRepositoryNode.cs
File metadata and controls
73 lines (60 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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>();
}
}