@@ -13,12 +13,16 @@ public class LayoutViewModel : ObservableObject
13
13
14
14
public LayoutViewModel ( )
15
15
{
16
+ // Layout mode
16
17
SelectedDefaultLayoutModeIndex = ( int ) DefaultLayoutMode ;
17
18
19
+ // Sorting options
18
20
SelectedDefaultSortingIndex = UserSettingsService . LayoutSettingsService . DefaultSortOption == SortOption . FileTag ? FileTagSortingIndex : ( int ) UserSettingsService . LayoutSettingsService . DefaultSortOption ;
21
+ SelectedDefaultSortPriorityIndex = UserSettingsService . LayoutSettingsService . DefaultSortDirectoriesAlongsideFiles ? 2 : UserSettingsService . LayoutSettingsService . DefaultSortFilesFirst ? 1 : 0 ;
22
+
23
+ // Grouping options
19
24
SelectedDefaultGroupingIndex = UserSettingsService . LayoutSettingsService . DefaultGroupOption == GroupOption . FileTag ? FileTagGroupingIndex : ( int ) UserSettingsService . LayoutSettingsService . DefaultGroupOption ;
20
25
SelectedDefaultGroupByDateUnitIndex = ( int ) UserSettingsService . LayoutSettingsService . DefaultGroupByDateUnit ;
21
- SelectedDefaultSortPriorityIndex = UserSettingsService . LayoutSettingsService . DefaultSortDirectoriesAlongsideFiles ? 2 : UserSettingsService . LayoutSettingsService . DefaultSortFilesFirst ? 1 : 0 ;
22
26
}
23
27
24
28
// Properties
@@ -38,6 +42,8 @@ public bool SyncFolderPreferencesAcrossDirectories
38
42
}
39
43
}
40
44
45
+ // Layout mode
46
+
41
47
public FolderLayoutModes DefaultLayoutMode
42
48
{
43
49
get => UserSettingsService . LayoutSettingsService . DefaultLayoutMode ;
@@ -67,53 +73,37 @@ public int SelectedDefaultLayoutModeIndex
67
73
}
68
74
69
75
76
+ // Sorting options
70
77
71
- public bool SortInDescendingOrder
78
+ private int selectedDefaultSortingIndex ;
79
+ public int SelectedDefaultSortingIndex
72
80
{
73
- get => UserSettingsService . LayoutSettingsService . DefaultDirectorySortDirection == SortDirection . Descending ;
81
+ get => selectedDefaultSortingIndex ;
74
82
set
75
83
{
76
- if ( value != ( UserSettingsService . LayoutSettingsService . DefaultDirectorySortDirection == SortDirection . Descending ) )
84
+ if ( SetProperty ( ref selectedDefaultSortingIndex , value ) )
77
85
{
78
- UserSettingsService . LayoutSettingsService . DefaultDirectorySortDirection = value ? SortDirection . Descending : SortDirection . Ascending ;
79
- OnPropertyChanged ( ) ;
80
- }
81
- }
82
- }
86
+ OnPropertyChanged ( nameof ( SelectedDefaultSortingIndex ) ) ;
83
87
84
- public bool GroupInDescendingOrder
85
- {
86
- get => UserSettingsService . LayoutSettingsService . DefaultDirectoryGroupDirection == SortDirection . Descending ;
87
- set
88
- {
89
- if ( value != ( UserSettingsService . LayoutSettingsService . DefaultDirectoryGroupDirection == SortDirection . Descending ) )
90
- {
91
- UserSettingsService . LayoutSettingsService . DefaultDirectoryGroupDirection = value ? SortDirection . Descending : SortDirection . Ascending ;
92
- OnPropertyChanged ( ) ;
88
+ UserSettingsService . LayoutSettingsService . DefaultSortOption = value == FileTagSortingIndex ? SortOption . FileTag : ( SortOption ) value ;
93
89
}
94
90
}
95
91
}
96
92
97
- public bool IsDefaultGrouped
98
- => UserSettingsService . LayoutSettingsService . DefaultGroupOption != GroupOption . None ;
99
-
100
- private int defaultGroupByDateUnitIndex ;
101
- public int SelectedDefaultGroupByDateUnitIndex
93
+ public bool SortInDescendingOrder
102
94
{
103
- get => defaultGroupByDateUnitIndex ;
95
+ get => UserSettingsService . LayoutSettingsService . DefaultDirectorySortDirection == SortDirection . Descending ;
104
96
set
105
97
{
106
- if ( SetProperty ( ref defaultGroupByDateUnitIndex , value ) )
98
+ if ( value != ( UserSettingsService . LayoutSettingsService . DefaultDirectorySortDirection == SortDirection . Descending ) )
107
99
{
108
- OnPropertyChanged ( nameof ( SelectedDefaultGroupByDateUnitIndex ) ) ;
109
- UserSettingsService . LayoutSettingsService . DefaultGroupByDateUnit = ( GroupByDateUnit ) value ;
100
+ UserSettingsService . LayoutSettingsService . DefaultDirectorySortDirection = value ? SortDirection . Descending : SortDirection . Ascending ;
101
+ OnPropertyChanged ( ) ;
110
102
}
111
103
}
112
104
}
113
105
114
- public bool IsGroupByDate
115
- => UserSettingsService . LayoutSettingsService . DefaultGroupOption . IsGroupByDate ( ) ;
116
-
106
+
117
107
private int selectedDefaultSortPriorityIndex ;
118
108
public int SelectedDefaultSortPriorityIndex
119
109
{
@@ -144,20 +134,8 @@ public int SelectedDefaultSortPriorityIndex
144
134
}
145
135
}
146
136
147
- private int selectedDefaultSortingIndex ;
148
- public int SelectedDefaultSortingIndex
149
- {
150
- get => selectedDefaultSortingIndex ;
151
- set
152
- {
153
- if ( SetProperty ( ref selectedDefaultSortingIndex , value ) )
154
- {
155
- OnPropertyChanged ( nameof ( SelectedDefaultSortingIndex ) ) ;
156
137
157
- UserSettingsService . LayoutSettingsService . DefaultSortOption = value == FileTagSortingIndex ? SortOption . FileTag : ( SortOption ) value ;
158
- }
159
- }
160
- }
138
+ // Grouping options
161
139
162
140
private int selectedDefaultGroupingIndex ;
163
141
public int SelectedDefaultGroupingIndex
@@ -178,6 +156,43 @@ public int SelectedDefaultGroupingIndex
178
156
}
179
157
}
180
158
159
+ public bool GroupInDescendingOrder
160
+ {
161
+ get => UserSettingsService . LayoutSettingsService . DefaultDirectoryGroupDirection == SortDirection . Descending ;
162
+ set
163
+ {
164
+ if ( value != ( UserSettingsService . LayoutSettingsService . DefaultDirectoryGroupDirection == SortDirection . Descending ) )
165
+ {
166
+ UserSettingsService . LayoutSettingsService . DefaultDirectoryGroupDirection = value ? SortDirection . Descending : SortDirection . Ascending ;
167
+ OnPropertyChanged ( ) ;
168
+ }
169
+ }
170
+ }
171
+
172
+ private int defaultGroupByDateUnitIndex ;
173
+
174
+ public int SelectedDefaultGroupByDateUnitIndex
175
+ {
176
+ get => defaultGroupByDateUnitIndex ;
177
+ set
178
+ {
179
+ if ( SetProperty ( ref defaultGroupByDateUnitIndex , value ) )
180
+ {
181
+ OnPropertyChanged ( nameof ( SelectedDefaultGroupByDateUnitIndex ) ) ;
182
+ UserSettingsService . LayoutSettingsService . DefaultGroupByDateUnit = ( GroupByDateUnit ) value ;
183
+ }
184
+ }
185
+ }
186
+
187
+ public bool IsGroupByDate
188
+ => UserSettingsService . LayoutSettingsService . DefaultGroupOption . IsGroupByDate ( ) ;
189
+
190
+ public bool IsDefaultGrouped
191
+ => UserSettingsService . LayoutSettingsService . DefaultGroupOption != GroupOption . None ;
192
+
193
+
194
+ // Details view
195
+
181
196
public bool ShowFileTagColumn
182
197
{
183
198
get => UserSettingsService . LayoutSettingsService . ShowFileTagColumn ;
@@ -248,6 +263,9 @@ public bool ShowDateColumn
248
263
}
249
264
}
250
265
266
+
267
+ // Methods
268
+
251
269
public void ResetLayoutPreferences ( )
252
270
{
253
271
// Is this proper practice?
0 commit comments