Skip to content

Code Quality: Added 'object? parameter' to every rich commands #15325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 7, 2024

Conversation

0x5bfa
Copy link
Member

@0x5bfa 0x5bfa commented May 7, 2024

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

  1. Opened Files
  2. Run one rich command to check if the command won't cause a crash

yaira2
yaira2 previously approved these changes May 7, 2024
@yaira2 yaira2 added the ready to merge Pull requests that are approved and ready to merge label May 7, 2024
@yaira2 yaira2 requested a review from hishitetsu May 7, 2024 15:46
@0x5bfa
Copy link
Member Author

0x5bfa commented May 7, 2024

After this and #15299 get merged, we can get started to work on using RichCommands with parameter here (CreateNewFileCommand):

if (!string.IsNullOrEmpty(i.IconBase64))
{
// loading the bitmaps takes a while, so this caches them
byte[] bitmapData = Convert.FromBase64String(i.IconBase64);
using var ms = new MemoryStream(bitmapData);
var bitmap = new BitmapImage();
_ = bitmap.SetSourceAsync(ms.AsRandomAccessStream());
list.Add(new ContextMenuFlyoutItemViewModel()
{
Text = i.Name,
BitmapIcon = bitmap,
Command = commandsViewModel.CreateNewFileCommand,
CommandParameter = i,
});
}
else
{
list.Add(new ContextMenuFlyoutItemViewModel()
{
Text = i.Name,
Glyph = "\xE7C3",
Command = commandsViewModel.CreateNewFileCommand,
CommandParameter = i,
});
}

This is one big step!

@yaira2 yaira2 merged commit 60b266a into files-community:main May 7, 2024
@0x5bfa 0x5bfa deleted the 5bfa/CQ-RichCommandParameter branch May 8, 2024 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants