@@ -51,16 +51,18 @@ await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPrio
51
51
if ( ( await distroFolder . GetFoldersAsync ( ) ) . Count != 0 )
52
52
{
53
53
var section = MainPage . SideBarItems . FirstOrDefault ( x => x . Text == "WSL" ) as LocationItem ;
54
-
55
- section = new LocationItem ( )
54
+ if ( section == null )
56
55
{
57
- Text = "WSL" ,
58
- Section = SectionType . WSL ,
59
- Glyph = "\uEC7A " ,
60
- SelectsOnInvoked = false ,
61
- ChildItems = new ObservableCollection < INavigationControlItem > ( )
62
- } ;
63
- MainPage . SideBarItems . Add ( section ) ;
56
+ section = new LocationItem ( )
57
+ {
58
+ Text = "WSL" ,
59
+ Section = SectionType . WSL ,
60
+ Glyph = "\uEC7A " ,
61
+ SelectsOnInvoked = false ,
62
+ ChildItems = new ObservableCollection < INavigationControlItem > ( )
63
+ } ;
64
+ MainPage . SideBarItems . Add ( section ) ;
65
+ }
64
66
65
67
foreach ( StorageFolder folder in await distroFolder . GetFoldersAsync ( ) )
66
68
{
@@ -90,12 +92,15 @@ await CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPrio
90
92
logoURI = new Uri ( "ms-appx:///Assets/WSL/genericpng.png" ) ;
91
93
}
92
94
93
- section . ChildItems . Add ( new WSLDistroItem ( )
95
+ if ( ! section . ChildItems . Any ( x => x . Path == folder . Path ) )
94
96
{
95
- Text = folder . DisplayName ,
96
- Path = folder . Path ,
97
- Logo = logoURI
98
- } ) ;
97
+ section . ChildItems . Add ( new WSLDistroItem ( )
98
+ {
99
+ Text = folder . DisplayName ,
100
+ Path = folder . Path ,
101
+ Logo = logoURI
102
+ } ) ;
103
+ }
99
104
}
100
105
}
101
106
}
0 commit comments