Skip to content
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

Code Quality: Remove ContextMenuFlyoutItemViewModelBuilder #14761

Open
0x5bfa opened this issue Feb 18, 2024 · 1 comment
Open

Code Quality: Remove ContextMenuFlyoutItemViewModelBuilder #14761

0x5bfa opened this issue Feb 18, 2024 · 1 comment
Assignees

Comments

@0x5bfa
Copy link
Member

0x5bfa commented Feb 18, 2024

Description

This is totally not needed just to create a context flyout item with IRichCommand and it can be merged into ContextMenuFlyoutItemViewModel (or simplified name: ContextFlyoutItemModel). In my research achieving this goal will reduce 200 lines.

And I will introduce this way of instancing:

new ContextFlyoutItemModel(ContextFlyoutItemType.Toggle, Commands.CopyItem, true), // isPrimary
new ContextFlyoutItemModel(ContextFlyoutItemType.Separator),
new ContextFlyoutItemModel()
{
    Items = new()
    {
        new ContextFlyoutItemModel(ContextFlyoutItemType.Toggle, Commands.LayoutTile),
        new ContextFlyoutItemModel(ContextFlyoutItemType.Toggle, Commands.LayoutDetails),
...
    }
}

Concerned code

  • ContextMenuFlyoutItemViewModelBuilder class
  • ContextMenuFlyoutItemViewModel class

Gains

  • A better readability

Requirements

  • Remove ContextMenuFlyoutItemViewModelBuilder
  • Add some constructors to ContextMenuFlyoutItemViewModel to be able to be used for IRichCommands.

Comments

No response

@0x5bfa 0x5bfa self-assigned this Feb 18, 2024
@0x5bfa
Copy link
Member Author

0x5bfa commented Feb 18, 2024

@yaira2 Waiting for approval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🆕 New
Development

Successfully merging a pull request may close this issue.

2 participants