11using System ;
22using System . IO ;
33
4- using Avalonia ;
54using Avalonia . Collections ;
65using Avalonia . Controls ;
76using Avalonia . Input ;
8- using Avalonia . Media ;
97
108using CommunityToolkit . Mvvm . ComponentModel ;
119
@@ -34,6 +32,7 @@ public Launcher(string startupRepo)
3432 Pages = new AvaloniaList < LauncherPage > ( ) ;
3533 AddNewTab ( ) ;
3634
35+ var pref = Preference . Instance ;
3736 if ( ! string . IsNullOrEmpty ( startupRepo ) )
3837 {
3938 var root = new Commands . QueryRepositoryRootPath ( startupRepo ) . Result ( ) ;
@@ -48,14 +47,14 @@ public Launcher(string startupRepo)
4847 }
4948
5049 var normalized = root . Replace ( "\\ " , "/" ) ;
51- var node = Preference . FindOrAddNodeByRepositoryPath ( normalized , null , false ) ;
50+ var node = pref . FindOrAddNodeByRepositoryPath ( normalized , null , false ) ;
5251 OpenRepositoryInTab ( node , null ) ;
5352 }
54- else if ( Preference . Instance . RestoreTabs )
53+ else if ( pref . RestoreTabs )
5554 {
56- foreach ( var id in Preference . Instance . OpenedTabs )
55+ foreach ( var id in pref . OpenedTabs )
5756 {
58- var node = Preference . FindNode ( id ) ;
57+ var node = pref . FindNode ( id ) ;
5958 if ( node == null )
6059 {
6160 node = new RepositoryNode ( )
@@ -70,7 +69,7 @@ public Launcher(string startupRepo)
7069 OpenRepositoryInTab ( node , null ) ;
7170 }
7271
73- var lastActiveIdx = Preference . Instance . LastActiveTabIdx ;
72+ var lastActiveIdx = pref . LastActiveTabIdx ;
7473 if ( lastActiveIdx >= 0 && lastActiveIdx < Pages . Count )
7574 ActivePage = Pages [ lastActiveIdx ] ;
7675 }
0 commit comments