Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/Files.App/Actions/Start/PinToStartAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,15 @@ public async Task ExecuteAsync(object? parameter = null)
{
foreach (ListedItem listedItem in context.ShellPage.SlimContentPage.SelectedItems)
{
IStorable storable = listedItem.IsFolder switch
await SafetyExtensions.IgnoreExceptions(async () =>
{
true => await StorageService.GetFolderAsync(listedItem.ItemPath),
_ => await StorageService.GetFileAsync((listedItem as ShortcutItem)?.TargetPath ?? listedItem.ItemPath)
};
await StartMenuService.PinAsync(storable, listedItem.Name);
IStorable storable = listedItem.IsFolder switch
{
true => await StorageService.GetFolderAsync(listedItem.ItemPath),
_ => await StorageService.GetFileAsync((listedItem as ShortcutItem)?.TargetPath ?? listedItem.ItemPath)
};
await StartMenuService.PinAsync(storable, listedItem.Name);
});
}
}
else if (context.ShellPage?.ShellViewModel?.CurrentFolder is not null)
Expand Down
13 changes: 8 additions & 5 deletions src/Files.App/Actions/Start/UnpinFromStartAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,15 @@ public async Task ExecuteAsync(object? parameter = null)
{
foreach (ListedItem listedItem in context.ShellPage?.SlimContentPage.SelectedItems)
{
IStorable storable = listedItem.IsFolder switch
await SafetyExtensions.IgnoreExceptions(async () =>
{
true => await StorageService.GetFolderAsync(listedItem.ItemPath),
_ => await StorageService.GetFileAsync((listedItem as ShortcutItem)?.TargetPath ?? listedItem.ItemPath)
};
await StartMenuService.UnpinAsync(storable);
IStorable storable = listedItem.IsFolder switch
{
true => await StorageService.GetFolderAsync(listedItem.ItemPath),
_ => await StorageService.GetFileAsync((listedItem as ShortcutItem)?.TargetPath ?? listedItem.ItemPath)
};
await StartMenuService.UnpinAsync(storable);
});
}
}
else
Expand Down