Example #1
0
        public CommandToolBarItem(ToolBarItemDefinition toolBarItem, Command command, IToolBar parent)
        {
            _toolBarItem = toolBarItem;
            _command = command;
            _parent = parent;

            command.PropertyChanged += OnCommandPropertyChanged;
        }
Example #2
0
        public CommandToolBarItem(ToolBarItemDefinition toolBarItem, Command command, IToolBar parent)
        {
            _toolBarItem = toolBarItem;
            _command = command;
            _keyGesture = IoC.Get<ICommandKeyGestureService>().GetPrimaryKeyGesture(_command.CommandDefinition);
            _parent = parent;

            command.PropertyChanged += OnCommandPropertyChanged;
        }
        private bool CanAddToolbarItem(ToolBarItemDefinition toolBarItem)
        {
            var result = true;

            if (!String.IsNullOrEmpty(toolBarItem.Text) && _fromTextExcludeDefinition != null)
            {
                result = !_fromTextExcludeDefinition.Any(p => p.Text.Replace("_", "").Equals(toolBarItem.Text.Replace("_", ""), StringComparison.OrdinalIgnoreCase));
            }

            var commandDefinitionBase = toolBarItem.CommandDefinition;

            if (result && _fromCommandNameExcludeDefinition != null && commandDefinitionBase != null)
            {
                result = !_fromCommandNameExcludeDefinition.Any(p => p.CommandDefinitionName.Equals(commandDefinitionBase.Name, StringComparison.OrdinalIgnoreCase));
            }

            return result;
        }