1
1
using System ;
2
2
using System . IO ;
3
3
4
- using Avalonia ;
5
4
using Avalonia . Collections ;
6
5
using Avalonia . Controls ;
7
6
using Avalonia . Input ;
8
- using Avalonia . Media ;
9
7
10
8
using CommunityToolkit . Mvvm . ComponentModel ;
11
9
@@ -34,6 +32,7 @@ public Launcher(string startupRepo)
34
32
Pages = new AvaloniaList < LauncherPage > ( ) ;
35
33
AddNewTab ( ) ;
36
34
35
+ var pref = Preference . Instance ;
37
36
if ( ! string . IsNullOrEmpty ( startupRepo ) )
38
37
{
39
38
var root = new Commands . QueryRepositoryRootPath ( startupRepo ) . Result ( ) ;
@@ -48,14 +47,14 @@ public Launcher(string startupRepo)
48
47
}
49
48
50
49
var normalized = root . Replace ( "\\ " , "/" ) ;
51
- var node = Preference . FindOrAddNodeByRepositoryPath ( normalized , null , false ) ;
50
+ var node = pref . FindOrAddNodeByRepositoryPath ( normalized , null , false ) ;
52
51
OpenRepositoryInTab ( node , null ) ;
53
52
}
54
- else if ( Preference . Instance . RestoreTabs )
53
+ else if ( pref . RestoreTabs )
55
54
{
56
- foreach ( var id in Preference . Instance . OpenedTabs )
55
+ foreach ( var id in pref . OpenedTabs )
57
56
{
58
- var node = Preference . FindNode ( id ) ;
57
+ var node = pref . FindNode ( id ) ;
59
58
if ( node == null )
60
59
{
61
60
node = new RepositoryNode ( )
@@ -70,7 +69,7 @@ public Launcher(string startupRepo)
70
69
OpenRepositoryInTab ( node , null ) ;
71
70
}
72
71
73
- var lastActiveIdx = Preference . Instance . LastActiveTabIdx ;
72
+ var lastActiveIdx = pref . LastActiveTabIdx ;
74
73
if ( lastActiveIdx >= 0 && lastActiveIdx < Pages . Count )
75
74
ActivePage = Pages [ lastActiveIdx ] ;
76
75
}
0 commit comments