@@ -131,7 +131,7 @@ public bool ShowFavoritesSection
131
131
if ( value != UserSettingsService . AppearanceSettingsService . ShowFavoritesSection )
132
132
{
133
133
UserSettingsService . AppearanceSettingsService . ShowFavoritesSection = value ;
134
- //App.SidebarPinnedController.Model.UpdateFavoritesSectionVisibility( );
134
+ UpdateSectionVisibility ( SectionType . Favorites , value ) ;
135
135
}
136
136
}
137
137
}
@@ -144,7 +144,7 @@ public bool ShowLibrarySection
144
144
if ( value != UserSettingsService . AppearanceSettingsService . ShowLibrarySection )
145
145
{
146
146
UserSettingsService . AppearanceSettingsService . ShowLibrarySection = value ;
147
- //App.LibraryManager.UpdateLibrariesSectionVisibility( );
147
+ UpdateSectionVisibility ( SectionType . Library , value ) ;
148
148
}
149
149
}
150
150
}
@@ -157,7 +157,7 @@ public bool ShowDrivesSection
157
157
if ( value != UserSettingsService . AppearanceSettingsService . ShowDrivesSection )
158
158
{
159
159
UserSettingsService . AppearanceSettingsService . ShowDrivesSection = value ;
160
- //App.DrivesManager.UpdateDrivesSectionVisibility( );
160
+ UpdateSectionVisibility ( SectionType . Drives , value ) ;
161
161
}
162
162
}
163
163
}
@@ -170,7 +170,7 @@ public bool ShowCloudDrivesSection
170
170
if ( value != UserSettingsService . AppearanceSettingsService . ShowCloudDrivesSection )
171
171
{
172
172
UserSettingsService . AppearanceSettingsService . ShowCloudDrivesSection = value ;
173
- //App.CloudDrivesManager.UpdateCloudDrivesSectionVisibility( );
173
+ UpdateSectionVisibility ( SectionType . CloudDrives , value ) ;
174
174
}
175
175
}
176
176
}
@@ -183,7 +183,7 @@ public bool ShowNetworkDrivesSection
183
183
if ( value != UserSettingsService . AppearanceSettingsService . ShowNetworkDrivesSection )
184
184
{
185
185
UserSettingsService . AppearanceSettingsService . ShowNetworkDrivesSection = value ;
186
- //App.NetworkDrivesManager.UpdateNetworkDrivesSectionVisibility( );
186
+ UpdateSectionVisibility ( SectionType . Network , value ) ;
187
187
}
188
188
}
189
189
}
@@ -196,7 +196,7 @@ public bool ShowWslSection
196
196
if ( value != UserSettingsService . AppearanceSettingsService . ShowWslSection )
197
197
{
198
198
UserSettingsService . AppearanceSettingsService . ShowWslSection = value ;
199
- //App.WSLDistroManager.UpdateWslSectionVisibility( );
199
+ UpdateSectionVisibility ( SectionType . WSL , value ) ;
200
200
}
201
201
}
202
202
}
@@ -209,7 +209,7 @@ public bool ShowFileTagsSection
209
209
if ( value != UserSettingsService . AppearanceSettingsService . ShowFileTagsSection )
210
210
{
211
211
UserSettingsService . AppearanceSettingsService . ShowFileTagsSection = value ;
212
- //App.FileTagsManager.UpdateFileTagsSectionVisibility( );
212
+ UpdateSectionVisibility ( SectionType . FileTag , value ) ;
213
213
}
214
214
}
215
215
}
@@ -542,6 +542,29 @@ private async Task<LocationItem> GetOrCreateSection(SectionType sectionType)
542
542
}
543
543
}
544
544
545
+ public async void UpdateSectionVisibility ( SectionType sectionType , bool show )
546
+ {
547
+ if ( show )
548
+ {
549
+ Func < Task > action = sectionType switch
550
+ {
551
+ SectionType . CloudDrives => App . CloudDrivesManager . EnumerateDrivesAsync ,
552
+ SectionType . Drives => App . DrivesManager . EnumerateDrivesAsync ,
553
+ SectionType . Network => App . NetworkDrivesManager . EnumerateDrivesAsync ,
554
+ SectionType . WSL => App . WSLDistroManager . EnumerateDrivesAsync ,
555
+ SectionType . FileTag => App . FileTagsManager . EnumerateFileTagsAsync ,
556
+ SectionType . Library => App . LibraryManager . EnumerateLibrariesAsync ,
557
+ SectionType . Favorites => App . SidebarPinnedController . Model . AddAllItemsToSidebar ,
558
+ _ => ( ) => Task . CompletedTask
559
+ } ;
560
+ await action ( ) ;
561
+ }
562
+ else
563
+ {
564
+ SideBarItems . Remove ( SideBarItems . FirstOrDefault ( x => x . Section == sectionType ) ) ;
565
+ }
566
+ }
567
+
545
568
public async void EmptyRecycleBin ( RoutedEventArgs e )
546
569
{
547
570
await RecycleBinHelpers . S_EmptyRecycleBin ( ) ;
0 commit comments