Exemplo n.º 1
0
        public void BuildToolBar(MesToolBarDefinition toolBarDefinition, IMesToolBar result)
        {
            var groups = _toolBarItemGroups
                         .Where(x => x.ToolBar == toolBarDefinition)
                         .OrderBy(x => x.SortOrder)
                         .ToList();

            for (int i = 0; i < groups.Count; i++)
            {
                var group        = groups[i];
                var toolBarItems = _toolBarItems
                                   .Where(x => x.Group == group)
                                   .OrderBy(x => x.SortOrder);

                foreach (var toolBarItem in toolBarItems)
                {
                    result.Add(new MesCommandToolBarItem(toolBarItem, _commandService.GetCommand(toolBarItem.CommandDefinition), result));
                }

                if (i < groups.Count - 1 && toolBarItems.Any())
                {
                    result.Add(new MesToolBarItemSeparator());
                }
            }
        }
        public MesCommandToolBarItem(MesToolBarItemDefinition toolBarItem, MesCommand command, IMesToolBar parent)
        {
            _toolBarItem = toolBarItem;
            _command     = command;
            _keyGesture  = Mvx.IoCProvider.Resolve <IMesCommandKeyGestureService>().GetPrimaryKeyGesture(_command.CommandDefinition);
            _parent      = parent;

            command.PropertyChanged += OnCommandPropertyChanged;
        }