diff --git a/src/ViewModels/Launcher.cs b/src/ViewModels/Launcher.cs index 97877a6d..c2dedc50 100644 --- a/src/ViewModels/Launcher.cs +++ b/src/ViewModels/Launcher.cs @@ -30,6 +30,11 @@ namespace SourceGit.ViewModels { OpenRepositoryInTab(node, null); } + + var lastActiveIdx = Preference.Instance.LastActiveTabIdx; + if (lastActiveIdx >= 0 && lastActiveIdx < Pages.Count) { + ActivePage = Pages[lastActiveIdx]; + } } } @@ -42,6 +47,7 @@ namespace SourceGit.ViewModels { } } + Preference.Instance.LastActiveTabIdx = Pages.IndexOf(ActivePage); Preference.Save(); } diff --git a/src/ViewModels/Preference.cs b/src/ViewModels/Preference.cs index d711622e..60f88d90 100644 --- a/src/ViewModels/Preference.cs +++ b/src/ViewModels/Preference.cs @@ -178,6 +178,11 @@ namespace SourceGit.ViewModels { set; } = new List(); + public int LastActiveTabIdx { + get; + set; + } = 0; + public static void AddNode(RepositoryNode node, RepositoryNode to = null) { var collection = to == null ? _instance._repositoryNodes : to.SubNodes; var list = new List();