mirror of
https://fastgit.cc/github.com/sourcegit-scm/sourcegit
synced 2026-04-24 19:02:39 +08:00
feature<Launcher>: finish restore opened tabs
This commit is contained in:
@@ -158,6 +158,11 @@ namespace SourceGit.ViewModels {
|
||||
set => SetProperty(ref _repositoryNodes, value);
|
||||
}
|
||||
|
||||
public List<string> OpenedTabs {
|
||||
get;
|
||||
set;
|
||||
} = new List<string>();
|
||||
|
||||
public static void AddNode(RepositoryNode node, RepositoryNode to = null) {
|
||||
var collection = to == null ? _instance._repositoryNodes : to.SubNodes;
|
||||
var list = new List<RepositoryNode>();
|
||||
@@ -177,6 +182,10 @@ namespace SourceGit.ViewModels {
|
||||
}
|
||||
}
|
||||
|
||||
public static RepositoryNode FindNode(string id) {
|
||||
return FindNodeRecursive(id, _instance.RepositoryNodes);
|
||||
}
|
||||
|
||||
public static void MoveNode(RepositoryNode node, RepositoryNode to = null) {
|
||||
if (to == null && _instance._repositoryNodes.Contains(node)) return;
|
||||
if (to != null && to.SubNodes.Contains(node)) return;
|
||||
@@ -222,6 +231,17 @@ namespace SourceGit.ViewModels {
|
||||
File.WriteAllText(_savePath, data);
|
||||
}
|
||||
|
||||
private static RepositoryNode FindNodeRecursive(string id, AvaloniaList<RepositoryNode> collection) {
|
||||
foreach (var node in collection) {
|
||||
if (node.Id == id) return node;
|
||||
|
||||
var sub = FindNodeRecursive(id, node.SubNodes);
|
||||
if (sub != null) return sub;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool RemoveNodeRecursive(RepositoryNode node, AvaloniaList<RepositoryNode> collection) {
|
||||
if (collection.Contains(node)) {
|
||||
collection.Remove(node);
|
||||
|
||||
Reference in New Issue
Block a user