Files icon indicating copy to clipboard operation
Files copied to clipboard

Code Quality: Remove ContextMenuFlyoutItemViewModelBuilder

Open 0x5bfa opened this issue 1 year ago • 1 comments

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 avatar Feb 18 '24 10:02 0x5bfa