--- source_files: - DataPRO/Modules/Menu/HamburgerMenu/Model/MenuCommand.cs generated_at: "2026-04-17T16:15:25.512508+00:00" model: "zai-org/GLM-5-FP8" schema_version: 1 sha256: "c31776c3db4a4afd" --- # Model ### Purpose This module provides the `MenuCommand` class, a simple `ICommand` implementation designed to handle hamburger menu item execution. It serves as a bridge between WPF's command binding system and the application's menu handling logic by invoking a delegate when a menu item is pressed, passing along the menu item's identifier. ### Public Interface **`MenuCommand` class** - Implements `System.Windows.Input.ICommand` - **`MenuCommand(string id, MenuItemPressedDelegate menuItemPressed)`** - Constructor. Takes a unique identifier for the menu item and a delegate to invoke upon execution. - **`bool CanExecute(object parameter)`** - Always returns `true`. The command is always executable. - **`void Execute(object parameter)`** - Invokes the `MenuItemPressed` delegate with the stored `Id`. - **`event EventHandler CanExecuteChanged`** - Standard `ICommand` event. Never raised in this implementation. ### Invariants - `CanExecute` will always return `true` regardless of the parameter value. - `Id` and `MenuItemPressed` are set at construction and cannot be changed (readonly). - `MenuItemPressed` delegate must be provided at construction time (no null check visible in source). ### Dependencies - **Depends on**: `DTS.Common.Interface.Menu.HamburgerMenu` (for `MenuItemPressedDelegate`) - **Depends on**: `System.Windows.Input` (for `ICommand` interface) ### Gotchas - The `CanExecuteChanged` event is declared but never invoked, meaning subscribers will never be notified of state changes. This is acceptable given `CanExecute` always returns `true`. - No null validation on constructor parameters. Passing a null `menuItemPressed` delegate will cause a runtime exception when `Execute` is called. ---