Skip to content

Commit 81d7dde

Browse files
authored
Merge branch 'main' into 5bfa/improve-codebase
2 parents 7fd174a + 68ce757 commit 81d7dde

File tree

27 files changed

+355
-106
lines changed

27 files changed

+355
-106
lines changed

src/Files.App/BaseLayout.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
using Windows.System;
3939
using static Files.App.Helpers.PathNormalization;
4040
using DispatcherQueueTimer = Microsoft.UI.Dispatching.DispatcherQueueTimer;
41+
using SortDirection = Files.Shared.Enums.SortDirection;
4142

4243
namespace Files.App
4344
{
@@ -402,6 +403,7 @@ protected override async void OnNavigatedTo(NavigationEventArgs eventArgs)
402403

403404
FolderSettings!.LayoutModeChangeRequested += BaseFolderSettings_LayoutModeChangeRequested;
404405
FolderSettings.GroupOptionPreferenceUpdated += FolderSettings_GroupOptionPreferenceUpdated;
406+
FolderSettings.GroupDirectionPreferenceUpdated += FolderSettings_GroupDirectionPreferenceUpdated;
405407

406408
ParentShellPageInstance.FilesystemViewModel.EmptyTextType = EmptyTextType.None;
407409
ParentShellPageInstance.ToolbarViewModel.UpdateSortAndGroupOptions();
@@ -511,7 +513,13 @@ navigationArguments.SelectItems is not null &&
511513

512514
private CancellationTokenSource? groupingCancellationToken;
513515

514-
private async void FolderSettings_GroupOptionPreferenceUpdated(object? sender, GroupOption e)
516+
private void FolderSettings_GroupOptionPreferenceUpdated(object? sender, GroupOption e)
517+
=> GroupPreferenceUpdated();
518+
519+
private void FolderSettings_GroupDirectionPreferenceUpdated(object? sender, SortDirection e)
520+
=> GroupPreferenceUpdated();
521+
522+
private async void GroupPreferenceUpdated()
515523
{
516524
// Two or more of these running at the same time will cause a crash, so cancel the previous one before beginning
517525
groupingCancellationToken?.Cancel();
@@ -533,6 +541,7 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
533541
CharacterReceived -= Page_CharacterReceived;
534542
FolderSettings!.LayoutModeChangeRequested -= BaseFolderSettings_LayoutModeChangeRequested;
535543
FolderSettings.GroupOptionPreferenceUpdated -= FolderSettings_GroupOptionPreferenceUpdated;
544+
FolderSettings.GroupDirectionPreferenceUpdated -= FolderSettings_GroupDirectionPreferenceUpdated;
536545
ItemContextMenuFlyout.Opening -= ItemContextFlyout_Opening;
537546
BaseContextMenuFlyout.Opening -= BaseContextFlyout_Opening;
538547

src/Files.App/Filesystem/FilesystemOperations/Helpers/FilesystemHelpers.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ await DialogDisplayHelper.ShowDialogAsync(
116116

117117
#region Delete
118118

119-
public async Task<ReturnResult> DeleteItemsAsync(IEnumerable<IStorageItemWithPath> source, bool showDialog, bool permanently, bool registerHistory)
119+
public async Task<ReturnResult> DeleteItemsAsync(IEnumerable<IStorageItemWithPath> source, DeleteConfirmationPolicies showDialog, bool permanently, bool registerHistory)
120120
{
121121
source = await source.ToListAsync();
122122

@@ -125,7 +125,8 @@ public async Task<ReturnResult> DeleteItemsAsync(IEnumerable<IStorageItemWithPat
125125
var deleteFromRecycleBin = source.Select(item => item.Path).Any(path => RecycleBinHelpers.IsPathUnderRecycleBin(path));
126126
var canBeSentToBin = !deleteFromRecycleBin && await RecycleBinHelpers.HasRecycleBin(source.FirstOrDefault()?.Path);
127127

128-
if (showDialog)
128+
if (showDialog is DeleteConfirmationPolicies.Always
129+
|| showDialog is DeleteConfirmationPolicies.PermanentOnly && (permanently || !canBeSentToBin))
129130
{
130131
var incomingItems = new List<BaseFileSystemDialogItemViewModel>();
131132
List<ShellFileItem>? binItems = null;
@@ -193,13 +194,13 @@ public async Task<ReturnResult> DeleteItemsAsync(IEnumerable<IStorageItemWithPat
193194
return returnStatus;
194195
}
195196

196-
public Task<ReturnResult> DeleteItemAsync(IStorageItemWithPath source, bool showDialog, bool permanently, bool registerHistory)
197+
public Task<ReturnResult> DeleteItemAsync(IStorageItemWithPath source, DeleteConfirmationPolicies showDialog, bool permanently, bool registerHistory)
197198
=> DeleteItemsAsync(source.CreateEnumerable(), showDialog, permanently, registerHistory);
198199

199-
public Task<ReturnResult> DeleteItemsAsync(IEnumerable<IStorageItem> source, bool showDialog, bool permanently, bool registerHistory)
200+
public Task<ReturnResult> DeleteItemsAsync(IEnumerable<IStorageItem> source, DeleteConfirmationPolicies showDialog, bool permanently, bool registerHistory)
200201
=> DeleteItemsAsync(source.Select((item) => item.FromStorageItem()), showDialog, permanently, registerHistory);
201202

202-
public Task<ReturnResult> DeleteItemAsync(IStorageItem source, bool showDialog, bool permanently, bool registerHistory)
203+
public Task<ReturnResult> DeleteItemAsync(IStorageItem source, DeleteConfirmationPolicies showDialog, bool permanently, bool registerHistory)
203204
=> DeleteItemAsync(source.FromStorageItem(), showDialog, permanently, registerHistory);
204205

205206
#endregion Delete
@@ -258,7 +259,7 @@ public async Task<ReturnResult> PerformOperationTypeAsync(DataPackageOperation o
258259
}
259260
if (destination.StartsWith(CommonPaths.RecycleBinPath, StringComparison.Ordinal))
260261
{
261-
return await RecycleItemsFromClipboard(packageView, destination, UserSettingsService.FoldersSettingsService.ShowConfirmDeleteDialog, registerHistory);
262+
return await RecycleItemsFromClipboard(packageView, destination, UserSettingsService.FoldersSettingsService.DeleteConfirmationPolicy, registerHistory);
262263
}
263264
else if (operation.HasFlag(DataPackageOperation.Copy))
264265
{
@@ -625,7 +626,7 @@ public async Task<ReturnResult> CreateShortcutFromClipboard(DataPackageView pack
625626
return returnStatus;
626627
}
627628

628-
public async Task<ReturnResult> RecycleItemsFromClipboard(DataPackageView packageView, string destination, bool showDialog, bool registerHistory)
629+
public async Task<ReturnResult> RecycleItemsFromClipboard(DataPackageView packageView, string destination, DeleteConfirmationPolicies showDialog, bool registerHistory)
629630
{
630631
if (!HasDraggedStorageItems(packageView))
631632
{

src/Files.App/Filesystem/FilesystemOperations/Helpers/IFilesystemHelpers.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public interface IFilesystemHelpers : IDisposable
2828
/// <param name="permanently">Determines whether <paramref name="source"/> is be deleted permanently</param>
2929
/// <param name="registerHistory">Determines whether <see cref="IStorageHistory"/> is saved</param>
3030
/// <returns><see cref="ReturnResult"/> of performed operation</returns>
31-
Task<ReturnResult> DeleteItemsAsync(IEnumerable<IStorageItem> source, bool showDialog, bool permanently, bool registerHistory);
31+
Task<ReturnResult> DeleteItemsAsync(IEnumerable<IStorageItem> source, DeleteConfirmationPolicies showDialog, bool permanently, bool registerHistory);
3232

3333
/// <summary>
3434
/// Deletes provided <paramref name="source"/>
@@ -38,7 +38,7 @@ public interface IFilesystemHelpers : IDisposable
3838
/// <param name="permanently">Determines whether <paramref name="source"/> is be deleted permanently</param>
3939
/// <param name="registerHistory">Determines whether <see cref="IStorageHistory"/> is saved</param>
4040
/// <returns><see cref="ReturnResult"/> of performed operation</returns>
41-
Task<ReturnResult> DeleteItemAsync(IStorageItem source, bool showDialog, bool permanently, bool registerHistory);
41+
Task<ReturnResult> DeleteItemAsync(IStorageItem source, DeleteConfirmationPolicies showDialog, bool permanently, bool registerHistory);
4242

4343
/// <summary>
4444
/// Deletes provided <paramref name="source"/>
@@ -48,7 +48,7 @@ public interface IFilesystemHelpers : IDisposable
4848
/// <param name="permanently">Determines whether <paramref name="source"/> is be deleted permanently</param>
4949
/// <param name="registerHistory">Determines whether <see cref="IStorageHistory"/> is saved</param>
5050
/// <returns><see cref="ReturnResult"/> of performed operation</returns>
51-
Task<ReturnResult> DeleteItemsAsync(IEnumerable<IStorageItemWithPath> source, bool showDialog, bool permanently, bool registerHistory);
51+
Task<ReturnResult> DeleteItemsAsync(IEnumerable<IStorageItemWithPath> source, DeleteConfirmationPolicies showDialog, bool permanently, bool registerHistory);
5252

5353
/// <summary>
5454
/// Deletes provided <paramref name="source"/>
@@ -58,7 +58,7 @@ public interface IFilesystemHelpers : IDisposable
5858
/// <param name="permanently">Determines whether <paramref name="source"/> is be deleted permanently</param>
5959
/// <param name="registerHistory">Determines whether <see cref="IStorageHistory"/> is saved</param>
6060
/// <returns><see cref="ReturnResult"/> of performed operation</returns>
61-
Task<ReturnResult> DeleteItemAsync(IStorageItemWithPath source, bool showDialog, bool permanently, bool registerHistory);
61+
Task<ReturnResult> DeleteItemAsync(IStorageItemWithPath source, DeleteConfirmationPolicies showDialog, bool permanently, bool registerHistory);
6262

6363
#endregion Delete
6464

@@ -175,7 +175,7 @@ public interface IFilesystemHelpers : IDisposable
175175
/// <returns><see cref="ReturnResult"/> of performed operation</returns>
176176
Task<ReturnResult> CopyItemsFromClipboard(DataPackageView packageView, string destination, bool showDialog, bool registerHistory);
177177

178-
Task<ReturnResult> RecycleItemsFromClipboard(DataPackageView packageView, string destination, bool showDialog, bool registerHistory);
178+
Task<ReturnResult> RecycleItemsFromClipboard(DataPackageView packageView, string destination, DeleteConfirmationPolicies showDialog, bool registerHistory);
179179

180180
Task<ReturnResult> CreateShortcutFromClipboard(DataPackageView packageView, string destination, bool showDialog, bool registerHistory);
181181

src/Files.App/Filesystem/ListedItem.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ public string[] FileTags
132132
{
133133
var dbInstance = FileTagsHelper.GetDbInstance();
134134
dbInstance.SetTags(ItemPath, FileFRN, value);
135+
HasTags = !FileTags.IsEmpty();
135136
FileTagsHelper.WriteFileTag(ItemPath, value);
136137
OnPropertyChanged(nameof(FileTagsUI));
137138
}
@@ -157,6 +158,13 @@ public double Opacity
157158
set => SetProperty(ref opacity, value);
158159
}
159160

161+
private bool hasTags;
162+
public bool HasTags
163+
{
164+
get => hasTags;
165+
set => SetProperty(ref hasTags, value);
166+
}
167+
160168
private CloudDriveSyncStatusUI syncStatusUI = new();
161169
public CloudDriveSyncStatusUI SyncStatusUI
162170
{

src/Files.App/Filesystem/StorageHistory/StorageHistoryOperations.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ public async Task<ReturnResult> Undo(IStorageHistory history)
3838
case FileOperationType.CreateNew: // Opposite: Delete created items
3939
if (!IsHistoryNull(history.Source))
4040
{
41-
return await helpers.DeleteItemsAsync(history.Source, true, true, false); // Show a dialog to prevent unexpected deletion
41+
// Show a dialog regardless of the setting to prevent unexpected deletion
42+
return await helpers.DeleteItemsAsync(history.Source, DeleteConfirmationPolicies.Always, true, false);
4243
}
4344
break;
4445
case FileOperationType.CreateLink: // Opposite: Delete created items
4546
if (!IsHistoryNull(history.Destination))
4647
{
47-
return await helpers.DeleteItemsAsync(history.Destination, true, true, false); // Show a dialog to prevent unexpected deletion
48+
// Show a dialog regardless of the setting to prevent unexpected deletion
49+
return await helpers.DeleteItemsAsync(history.Destination, DeleteConfirmationPolicies.Always, true, false);
4850
}
4951
break;
5052
case FileOperationType.Rename: // Opposite: Restore original item names
@@ -61,7 +63,8 @@ public async Task<ReturnResult> Undo(IStorageHistory history)
6163
case FileOperationType.Copy: // Opposite: Delete copied items
6264
if (!IsHistoryNull(history.Destination))
6365
{
64-
return await helpers.DeleteItemsAsync(history.Destination, true, true, false); // Show a dialog to prevent unexpected deletion
66+
// Show a dialog regardless of the setting to prevent unexpected deletion
67+
return await helpers.DeleteItemsAsync(history.Destination, DeleteConfirmationPolicies.Always, true, false);
6568
}
6669
break;
6770
case FileOperationType.Move: // Opposite: Move the items to original directory

src/Files.App/Helpers/ContextFlyoutItemHelper.cs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,40 @@ public static List<ContextMenuFlyoutItemViewModel> GetBaseLayoutMenuItems(Curren
469469
ItemType = ItemType.Toggle,
470470
ShowItem = currentInstanceViewModel.IsPageTypeLibrary,
471471
},
472+
new ContextMenuFlyoutItemViewModel()
473+
{
474+
ItemType = ItemType.Separator,
475+
ShowInRecycleBin = true,
476+
ShowInSearchPage = true,
477+
ShowInFtpPage = true,
478+
ShowInZipPage = true,
479+
},
480+
new ContextMenuFlyoutItemViewModel()
481+
{
482+
Text = "Ascending".GetLocalizedResource(),
483+
IsChecked = currentInstanceViewModel.FolderSettings.DirectoryGroupDirection == SortDirection.Ascending,
484+
IsEnabled = currentInstanceViewModel.FolderSettings.DirectoryGroupOption != GroupOption.None,
485+
ShowInRecycleBin = true,
486+
ShowInSearchPage = true,
487+
ShowInFtpPage = true,
488+
ShowInZipPage = true,
489+
Command = currentInstanceViewModel.FolderSettings.ChangeGroupDirectionCommand,
490+
CommandParameter = SortDirection.Ascending,
491+
ItemType = ItemType.Toggle,
492+
},
493+
new ContextMenuFlyoutItemViewModel()
494+
{
495+
Text = "Descending".GetLocalizedResource(),
496+
IsChecked = currentInstanceViewModel.FolderSettings.DirectoryGroupDirection == SortDirection.Descending,
497+
IsEnabled = currentInstanceViewModel.FolderSettings.DirectoryGroupOption != GroupOption.None,
498+
ShowInRecycleBin = true,
499+
ShowInSearchPage = true,
500+
ShowInFtpPage = true,
501+
ShowInZipPage = true,
502+
Command = currentInstanceViewModel.FolderSettings.ChangeGroupDirectionCommand,
503+
CommandParameter = SortDirection.Descending,
504+
ItemType = ItemType.Toggle,
505+
},
472506
}
473507
},
474508
new ContextMenuFlyoutItemViewModel()

src/Files.App/Helpers/ItemListDisplayHelpers/GroupingHelper.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,12 +140,12 @@ public static (string key, string text, string range, int index) GetGroupSizeInf
140140
if (size > sizeGp.size)
141141
{
142142
var rangeStr = i > 0 ? $"{sizeGp.sizeText} - {sizeGroups[i - 1].sizeText}" : $"{sizeGp.sizeText} +";
143-
return (sizeGp.size.ToString(), sizeGp.text, rangeStr, i + 1); //i +1 is so that other groups always show below "unspecified"
143+
return (sizeGp.size.ToString(), sizeGp.text, rangeStr, sizeGroups.Length - i);
144144
}
145145
lastSizeStr = sizeGp.sizeText;
146146
}
147147

148-
return ("0", "ItemSizeText_Tiny".GetLocalizedResource(), $"{"0 B".ConvertSizeAbbreviation()} - {lastSizeStr}", sizeGroups.Length + 1);
148+
return ("0", "ItemSizeText_Tiny".GetLocalizedResource(), $"{"0 B".ConvertSizeAbbreviation()} - {lastSizeStr}", 0);
149149
}
150150

151151
public static string GetGroupSizeKey(long size)
@@ -175,4 +175,4 @@ public interface IGroupableItem
175175
{
176176
public string Key { get; set; }
177177
}
178-
}
178+
}

src/Files.App/Helpers/LayoutPreferences/LayoutPreferences.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ public class LayoutPreferences
1313
public SortDirection DirectorySortDirection;
1414
public bool SortDirectoriesAlongsideFiles;
1515
public GroupOption DirectoryGroupOption;
16+
public SortDirection DirectoryGroupDirection;
1617
public FolderLayoutModes LayoutMode;
1718
public int GridViewSize;
1819
public bool IsAdaptiveLayoutOverridden;
@@ -30,8 +31,9 @@ public LayoutPreferences()
3031
GridViewSize = UserSettingsService.LayoutSettingsService.DefaultGridViewSize;
3132
DirectorySortOption = UserSettingsService.FoldersSettingsService.DefaultSortOption;
3233
DirectoryGroupOption = UserSettingsService.FoldersSettingsService.DefaultGroupOption;
33-
DirectorySortDirection = UserSettingsService.LayoutSettingsService.DefaultDirectorySortDirection;
34-
SortDirectoriesAlongsideFiles = UserSettingsService.LayoutSettingsService.DefaultSortDirectoriesAlongsideFiles;
34+
DirectorySortDirection = UserSettingsService.FoldersSettingsService.DefaultDirectorySortDirection;
35+
DirectoryGroupDirection = UserSettingsService.FoldersSettingsService.DefaultDirectoryGroupDirection;
36+
SortDirectoriesAlongsideFiles = UserSettingsService.FoldersSettingsService.DefaultSortDirectoriesAlongsideFiles;
3537
IsAdaptiveLayoutOverridden = defaultLayout is not FolderLayoutModes.Adaptive;
3638

3739
ColumnsViewModel = new ColumnsViewModel();
@@ -71,6 +73,7 @@ public override bool Equals(object? obj)
7173
prefs.DirectoryGroupOption == DirectoryGroupOption &&
7274
prefs.DirectorySortOption == DirectorySortOption &&
7375
prefs.DirectorySortDirection == DirectorySortDirection &&
76+
prefs.DirectoryGroupDirection == DirectoryGroupDirection &&
7477
prefs.SortDirectoriesAlongsideFiles == SortDirectoriesAlongsideFiles &&
7578
prefs.IsAdaptiveLayoutOverridden == IsAdaptiveLayoutOverridden &&
7679
prefs.ColumnsViewModel.Equals(ColumnsViewModel));
@@ -85,6 +88,7 @@ public override int GetHashCode()
8588
hashCode = (hashCode * 397) ^ DirectoryGroupOption.GetHashCode();
8689
hashCode = (hashCode * 397) ^ DirectorySortOption.GetHashCode();
8790
hashCode = (hashCode * 397) ^ DirectorySortDirection.GetHashCode();
91+
hashCode = (hashCode * 397) ^ DirectoryGroupDirection.GetHashCode();
8892
hashCode = (hashCode * 397) ^ SortDirectoriesAlongsideFiles.GetHashCode();
8993
hashCode = (hashCode * 397) ^ IsAdaptiveLayoutOverridden.GetHashCode();
9094
hashCode = (hashCode * 397) ^ ColumnsViewModel.GetHashCode();

src/Files.App/Helpers/NavigationHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public static async Task<bool> OpenPath(string path, IShellPage associatedInstan
179179

180180
// Delete shortcut
181181
var shortcutItem = StorageHelpers.FromPathAndType(path, FilesystemItemType.File);
182-
await associatedInstance.FilesystemHelpers.DeleteItemAsync(shortcutItem, false, false, true);
182+
await associatedInstance.FilesystemHelpers.DeleteItemAsync(shortcutItem, DeleteConfirmationPolicies.Never, false, true);
183183
}
184184
}
185185
else if (isReparsePoint)

src/Files.App/Helpers/RecycleBinHelpers.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ public static async Task EmptyRecycleBin()
6363
SecondaryButtonText = "Cancel".GetLocalizedResource(),
6464
DefaultButton = ContentDialogButton.Primary
6565
};
66-
ContentDialogResult result = await SetContentDialogRoot(ConfirmEmptyBinDialog).ShowAsync();
6766

68-
if (result == ContentDialogResult.Primary)
67+
if (userSettingsService.FoldersSettingsService.DeleteConfirmationPolicy is DeleteConfirmationPolicies.Never
68+
|| await SetContentDialogRoot(ConfirmEmptyBinDialog).ShowAsync() == ContentDialogResult.Primary)
6969
{
7070
string bannerTitle = "EmptyRecycleBin".GetLocalizedResource();
7171
var banner = App.OngoingTasksViewModel.PostBanner(
@@ -173,7 +173,7 @@ public static async Task DeleteItem(IShellPage associatedInstance)
173173
var items = associatedInstance.SlimContentPage.SelectedItems.ToList().Select((item) => StorageHelpers.FromPathAndType(
174174
item.ItemPath,
175175
item.PrimaryItemAttribute == StorageItemTypes.File ? FilesystemItemType.File : FilesystemItemType.Directory));
176-
await associatedInstance.FilesystemHelpers.DeleteItemsAsync(items, userSettingsService.FoldersSettingsService.ShowConfirmDeleteDialog, false, true);
176+
await associatedInstance.FilesystemHelpers.DeleteItemsAsync(items, userSettingsService.FoldersSettingsService.DeleteConfirmationPolicy, false, true);
177177
}
178178
}
179179
}

src/Files.App/ServicesImplementation/DateTimeFormatter/AbstractDateTimeFormatter.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ public ITimeSpanLabel ToTimeSpanLabel(DateTimeOffset offset)
2828

2929
return 0 switch
3030
{
31-
_ when now.Date == time.Date => new Label("Today", "\ue184", 0),
32-
_ when y.Date == time.Date => new Label("ItemTimeText_Yesterday", "\ue161", 1),
33-
_ when diff.Days < 7 && w.Year == time.Year && GetWeekOfYear(w) == GetWeekOfYear(time) => new Label("ItemTimeText_ThisWeek", "\uE162", 2),
34-
_ when diff.Days < 14 && w.Year == time.Year && GetWeekOfYear(w) == GetWeekOfYear(time) => new Label("ItemTimeText_LastWeek", "\uE162", 3),
35-
_ when now.Year == time.Year && now.Month == time.Month => new Label("ItemTimeText_ThisMonth", "\ue163", 4),
36-
_ when now.AddMonths(-1).Year == time.Year && now.AddMonths(-1).Month == time.Month => new Label("ItemTimeText_LastMonth", "\ue163", 5),
37-
_ when now.Year == time.Year => new Label("ItemTimeText_ThisYear", "\ue163", 5),
38-
_ => new Label("ItemTimeText_Older", "\uEC92", 6),
31+
_ when now.Date == time.Date => new Label("Today", "\ue184", 7),
32+
_ when y.Date == time.Date => new Label("ItemTimeText_Yesterday", "\ue161", 6),
33+
_ when diff.Days < 7 && w.Year == time.Year && GetWeekOfYear(w) == GetWeekOfYear(time) => new Label("ItemTimeText_ThisWeek", "\uE162", 5),
34+
_ when diff.Days < 14 && w.Year == time.Year && GetWeekOfYear(w) == GetWeekOfYear(time) => new Label("ItemTimeText_LastWeek", "\uE162", 4),
35+
_ when now.Year == time.Year && now.Month == time.Month => new Label("ItemTimeText_ThisMonth", "\ue163", 3),
36+
_ when now.AddMonths(-1).Year == time.Year && now.AddMonths(-1).Month == time.Month => new Label("ItemTimeText_LastMonth", "\ue163", 2),
37+
_ when now.Year == time.Year => new Label("ItemTimeText_ThisYear", "\ue163", 1),
38+
_ => new Label("ItemTimeText_Older", "\uEC92", 0),
3939
};
4040
}
4141

0 commit comments

Comments
 (0)