mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 19:55:00 +00:00
feature<Launcher>: finish restore opened tabs
This commit is contained in:
parent
d895beb3f4
commit
49154afe48
3 changed files with 45 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue