Exemplo n.º 1
0
        void ICommandUiItem.Update(CommandHandlerWrapper commandHandler)
        {
            if (_command != null && _command.CommandDefinition.IsList && !IsListItem)
            {
                foreach (var listItem in _listItems)
                {
                    _parent.Children.Remove(listItem);
                }

                _listItems.Clear();

                var listCommands = new List <Command>();
                commandHandler.Populate(_command, listCommands);

                _command.Visible = false;

                int startIndex = _parent.Children.IndexOf(this) + 1;

                foreach (var command in listCommands)
                {
                    var newMenuItem = new CommandMenuItem(command, _parent)
                    {
                        IsListItem = true
                    };
                    _parent.Children.Insert(startIndex++, newMenuItem);
                    _listItems.Add(newMenuItem);
                }
            }
        }
Exemplo n.º 2
0
        void ICommandUiItem.Update(CommandHandler commandHandler)
        {
            if (_command != null && _command.CommandDefinition.IsList && !IsListItem)
            {
                foreach (var listItem in _listItems)
                    _parent.Children.Remove(listItem);

                _listItems.Clear();

                var listCommands = new List<Command>();
                commandHandler.Update(_command, listCommands);

                _command.Visible = false;

                int startIndex = _parent.Children.IndexOf(this) + 1;

                foreach (var command in listCommands)
                {
                    var newMenuItem = new CommandMenuItem(command, _parent)
                    {
                        IsListItem = true
                    };
                    _parent.Children.Insert(startIndex++, newMenuItem);
                    _listItems.Add(newMenuItem);
                }
            }
        }