//--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="ToolBarsCommandItem"/> class.
        /// </summary>
        /// <param name="commandExtension">The commands extension.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="commandExtension"/> is <see langword="null"/>.
        /// </exception>
        public ToolBarsCommandItem(CommandExtension commandExtension)
        {
            if (commandExtension == null)
            {
                throw new ArgumentNullException(nameof(commandExtension));
            }

            _commandExtension = commandExtension;

            _toggleToolBarCommand = new DelegateCommand <ToolBarViewModel>(ToggleToolBar, CanToggleToolBarVisibility);

            ToggleAllToolBarsCommand = new DelegateCommand <bool>(ToggleAllToolBars, CanToggleAllToolBars);

            // Ideally, we remove this event handler when the commands extension is shutdown -
            // but we skip this for now...
            _commandExtension.Editor.UIInvalidated += OnEditorUIInvalidated;
        }
Esempio n. 2
0
        //--------------------------------------------------------------
        #region Creation & Cleanup
        //--------------------------------------------------------------

        /// <summary>
        /// Initializes a new instance of the <see cref="ToolBarsCommandItem"/> class.
        /// </summary>
        /// <param name="commandExtension">The commands extension.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="commandExtension"/> is <see langword="null"/>.
        /// </exception>
        public ToolBarsCommandItem(CommandExtension commandExtension)
        {
            if (commandExtension == null)
                throw new ArgumentNullException(nameof(commandExtension));

            _commandExtension = commandExtension;

            _toggleToolBarCommand = new DelegateCommand<ToolBarViewModel>(ToggleToolBar, CanToggleToolBarVisibility);

            ToggleAllToolBarsCommand = new DelegateCommand<bool>(ToggleAllToolBars, CanToggleAllToolBars);

            // Ideally, we remove this event handler when the commands extension is shutdown - 
            // but we skip this for now...
            _commandExtension.Editor.UIInvalidated += OnEditorUIInvalidated;
        }