@@ -276,6 +276,8 @@ public int GridViewSize
276
276
public event EventHandler < GroupOption > GroupOptionPreferenceUpdated ;
277
277
278
278
public event EventHandler < SortDirection > SortDirectionPreferenceUpdated ;
279
+
280
+ public event EventHandler < bool > SortDirectoriesAlongsideFilesPreferenceUpdated ;
279
281
280
282
public SortOption DirectorySortOption
281
283
{
@@ -318,6 +320,28 @@ public SortDirection DirectorySortDirection
318
320
}
319
321
}
320
322
323
+ public bool SortDirectoriesAlongsideFiles
324
+ {
325
+ get
326
+ {
327
+ return UserSettingsService . PreferencesSettingsService . AreLayoutPreferencesPerFolder ?
328
+ LayoutPreference . SortDirectoriesAlongsideFiles :
329
+ UserSettingsService . PreferencesSettingsService . ListAndSortDirectoriesAlongsideFiles ;
330
+ }
331
+ set
332
+ {
333
+ if ( SetProperty ( ref LayoutPreference . SortDirectoriesAlongsideFiles , value , nameof ( SortDirectoriesAlongsideFiles ) ) )
334
+ {
335
+ LayoutPreferencesUpdateRequired ? . Invoke ( this , new LayoutPreferenceEventArgs ( LayoutPreference ) ) ;
336
+ SortDirectoriesAlongsideFilesPreferenceUpdated ? . Invoke ( this , SortDirectoriesAlongsideFiles ) ;
337
+ if ( ! UserSettingsService . PreferencesSettingsService . AreLayoutPreferencesPerFolder )
338
+ {
339
+ UserSettingsService . PreferencesSettingsService . ListAndSortDirectoriesAlongsideFiles = value ;
340
+ }
341
+ }
342
+ }
343
+ }
344
+
321
345
public ColumnsViewModel ColumnsViewModel
322
346
{
323
347
get => LayoutPreference . ColumnsViewModel ;
@@ -371,6 +395,7 @@ public void UpdateLayoutPreferencesForPath(string folderPath, LayoutPreferences
371
395
UserSettingsService . LayoutSettingsService . DefaultDirectoryGroupOption = prefs . DirectoryGroupOption ;
372
396
}
373
397
UserSettingsService . LayoutSettingsService . DefaultDirectorySortDirection = prefs . DirectorySortDirection ;
398
+ UserSettingsService . LayoutSettingsService . DefaultSortDirectoriesAlongsideFiles = prefs . SortDirectoriesAlongsideFiles ;
374
399
UserSettingsService . LayoutSettingsService . ShowDateColumn = ! prefs . ColumnsViewModel . DateModifiedColumn . UserCollapsed ;
375
400
UserSettingsService . LayoutSettingsService . ShowDateCreatedColumn = ! prefs . ColumnsViewModel . DateCreatedColumn . UserCollapsed ;
376
401
UserSettingsService . LayoutSettingsService . ShowTypeColumn = ! prefs . ColumnsViewModel . ItemTypeColumn . UserCollapsed ;
@@ -426,6 +451,7 @@ private static LayoutPreferences ReadLayoutPreferencesFromSettings(string folder
426
451
GridViewSize = userSettingsService . LayoutSettingsService . DefaultGridViewSize ,
427
452
DirectorySortOption = userSettingsService . LayoutSettingsService . DefaultDirectorySortOption ,
428
453
DirectorySortDirection = userSettingsService . LayoutSettingsService . DefaultDirectorySortDirection ,
454
+ SortDirectoriesAlongsideFiles = userSettingsService . LayoutSettingsService . DefaultSortDirectoriesAlongsideFiles ,
429
455
ColumnsViewModel = new ColumnsViewModel ( ) ,
430
456
DirectoryGroupOption = GroupOption . DateCreated ,
431
457
} ;
@@ -439,6 +465,7 @@ private static LayoutPreferences ReadLayoutPreferencesFromSettings(string folder
439
465
GridViewSize = userSettingsService . LayoutSettingsService . DefaultGridViewSize ,
440
466
DirectorySortOption = userSettingsService . LayoutSettingsService . DefaultDirectorySortOption ,
441
467
DirectorySortDirection = userSettingsService . LayoutSettingsService . DefaultDirectorySortDirection ,
468
+ SortDirectoriesAlongsideFiles = userSettingsService . LayoutSettingsService . DefaultSortDirectoriesAlongsideFiles ,
442
469
ColumnsViewModel = new ColumnsViewModel ( ) ,
443
470
DirectoryGroupOption = GroupOption . FolderPath ,
444
471
} ;
@@ -479,6 +506,7 @@ private set
479
506
OnPropertyChanged ( nameof ( DirectoryGroupOption ) ) ;
480
507
OnPropertyChanged ( nameof ( DirectorySortOption ) ) ;
481
508
OnPropertyChanged ( nameof ( DirectorySortDirection ) ) ;
509
+ OnPropertyChanged ( nameof ( SortDirectoriesAlongsideFiles ) ) ;
482
510
}
483
511
}
484
512
}
@@ -489,6 +517,7 @@ public class LayoutPreferences
489
517
490
518
public SortOption DirectorySortOption ;
491
519
public SortDirection DirectorySortDirection ;
520
+ public bool SortDirectoriesAlongsideFiles ;
492
521
public GroupOption DirectoryGroupOption ;
493
522
public FolderLayoutModes LayoutMode ;
494
523
public int GridViewSize ;
@@ -506,6 +535,7 @@ public LayoutPreferences()
506
535
this . DirectorySortOption = UserSettingsService . LayoutSettingsService . DefaultDirectorySortOption ;
507
536
this . DirectoryGroupOption = UserSettingsService . LayoutSettingsService . DefaultDirectoryGroupOption ;
508
537
this . DirectorySortDirection = UserSettingsService . LayoutSettingsService . DefaultDirectorySortDirection ;
538
+ this . SortDirectoriesAlongsideFiles = UserSettingsService . LayoutSettingsService . DefaultSortDirectoriesAlongsideFiles ;
509
539
510
540
this . ColumnsViewModel = new ColumnsViewModel ( ) ;
511
541
this . ColumnsViewModel . DateCreatedColumn . UserCollapsed = ! UserSettingsService . LayoutSettingsService . ShowDateCreatedColumn ;
@@ -525,7 +555,8 @@ public static LayoutPreferences FromCompositeValue(ApplicationDataCompositeValue
525
555
GridViewSize = ( int ) compositeValue [ nameof ( GridViewSize ) ] ,
526
556
DirectorySortOption = ( SortOption ) ( int ) compositeValue [ nameof ( DirectorySortOption ) ] ,
527
557
DirectorySortDirection = ( SortDirection ) ( int ) compositeValue [ nameof ( DirectorySortDirection ) ] ,
528
- IsAdaptiveLayoutOverridden = compositeValue [ nameof ( IsAdaptiveLayoutOverridden ) ] is bool val ? val : false ,
558
+ SortDirectoriesAlongsideFiles = compositeValue [ nameof ( SortDirectoriesAlongsideFiles ) ] is bool val ? val : false ,
559
+ IsAdaptiveLayoutOverridden = compositeValue [ nameof ( IsAdaptiveLayoutOverridden ) ] is bool val2 ? val2 : false ,
529
560
} ;
530
561
531
562
if ( compositeValue . TryGetValue ( nameof ( DirectoryGroupOption ) , out var gpOption ) )
@@ -556,7 +587,8 @@ public ApplicationDataCompositeValue ToCompositeValue()
556
587
{ nameof ( DirectorySortOption ) , ( int ) this . DirectorySortOption } ,
557
588
{ nameof ( DirectoryGroupOption ) , ( int ) this . DirectoryGroupOption } ,
558
589
{ nameof ( DirectorySortDirection ) , ( int ) this . DirectorySortDirection } ,
559
- { nameof ( IsAdaptiveLayoutOverridden ) , ( bool ) this . IsAdaptiveLayoutOverridden } ,
590
+ { nameof ( SortDirectoriesAlongsideFiles ) , this . SortDirectoriesAlongsideFiles } ,
591
+ { nameof ( IsAdaptiveLayoutOverridden ) , this . IsAdaptiveLayoutOverridden } ,
560
592
{ nameof ( ColumnsViewModel ) , JsonConvert . SerializeObject ( this . ColumnsViewModel ) }
561
593
} ;
562
594
}
@@ -578,6 +610,7 @@ public override bool Equals(object obj)
578
610
prefs . GridViewSize == this . GridViewSize &&
579
611
prefs . DirectorySortOption == this . DirectorySortOption &&
580
612
prefs . DirectorySortDirection == this . DirectorySortDirection &&
613
+ prefs . SortDirectoriesAlongsideFiles == this . SortDirectoriesAlongsideFiles &&
581
614
prefs . IsAdaptiveLayoutOverridden == this . IsAdaptiveLayoutOverridden &&
582
615
prefs . ColumnsViewModel == this . ColumnsViewModel ) ;
583
616
}
0 commit comments