void IMesCommandUiItem.Update(MesCommandHandlerWrapper commandHandler) { if (_command != null && _command.CommandDefinition.IsList && !IsListItem) { foreach (MesStandardMenuItem listItem in _listItems) { _parent.Children.Remove(listItem); } _listItems.Clear(); List <MesCommand> listCommands = new List <MesCommand>(); commandHandler.Populate(_command, listCommands); _command.Visible = false; Int32 startIndex = _parent.Children.IndexOf(this) + 1; foreach (MesCommand command in listCommands) { MesCommandMenuItem newMenuItem = new MesCommandMenuItem(command, _parent) { IsListItem = true }; _parent.Children.Insert(startIndex++, newMenuItem); _listItems.Add(newMenuItem); } } }
public async void Execute(Object parameter) { MesCommandHandlerWrapper commandHandler = _commandRouter.GetCommandHandler(_command.CommandDefinition); if (commandHandler == null) { return; } await commandHandler.Run(_command); }
public Boolean CanExecute(Object parameter) { MesCommandHandlerWrapper commandHandler = _commandRouter.GetCommandHandler(_command.CommandDefinition); if (commandHandler == null) { return(false); } commandHandler.Update(_command); return(_command.Enabled); }
private static MesCommandHandlerWrapper CreateCommandHandlerWrapper(Type commandDefinitionType, Object commandHandler) { if (typeof(MesCommandDefinition).IsAssignableFrom(commandDefinitionType)) { return(MesCommandHandlerWrapper.FromCommandHandler(CommandHandlerInterfaceType.MakeGenericType(commandDefinitionType), commandHandler)); } if (typeof(MesCommandListDefinition).IsAssignableFrom(commandDefinitionType)) { return(MesCommandHandlerWrapper.FromCommandListHandler(CommandListHandlerInterfaceType.MakeGenericType(commandDefinitionType), commandHandler)); } throw new InvalidOperationException(); }
void IMesCommandUiItem.Update(MesCommandHandlerWrapper commandHandler) { // TODO }