public CommandLoader(CommandManager commandManager, params CommandId[] commandIds)
        {
            if (commandManager == null)
                throw new ArgumentNullException("commandManager");

            this._commandManager = commandManager;
            try
            {
                _commandManager.BeginUpdate();
                foreach (CommandId commandId in commandIds)
                {
                    Command command = new Command(commandId);
                    commandManager.Add(command);
                    _loadedCommands.Add(command);
                }
            }
            catch (Exception)
            {
                Dispose();
                throw;
            }
            finally
            {
                _commandManager.EndUpdate();
            }
        }
        public MarginCommand(CommandManager commandManager)
            : base(CommandId.MarginsGroup)
        {
            RepresentativeString = Res.Get(StringId.SpinnerPixelRepresentativeString);
            FormatString = Res.Get(StringId.SpinnerPixelFormatString);

            // @RIBBON TODO: Have a way to initialize this.
            marginValue = new Padding(Convert.ToInt32(MinMargin));

            commandManager.BeginUpdate();

            commandLeftMargin = new SpinnerCommand(CommandId.AdjustLeftMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString);
            commandManager.Add(commandLeftMargin, commandMargin_ExecuteWithArgs);

            commandTopMargin = new SpinnerCommand(CommandId.AdjustTopMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString);
            commandManager.Add(commandTopMargin, commandMargin_ExecuteWithArgs);

            commandRightMargin = new SpinnerCommand(CommandId.AdjustRightMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString);
            commandManager.Add(commandRightMargin, commandMargin_ExecuteWithArgs);

            commandBottomMargin = new SpinnerCommand(CommandId.AdjustBottomMargin, MinMargin, MaxMargin, MinMargin, Increment, DecimalPlaces, RepresentativeString, FormatString);
            commandManager.Add(commandBottomMargin, commandMargin_ExecuteWithArgs);

            commandManager.EndUpdate();
        }
        public CommandLoader(CommandManager commandManager, params CommandId[] commandIds)
        {
            if (commandManager == null)
            {
                throw new ArgumentNullException("commandManager");
            }

            this._commandManager = commandManager;
            try
            {
                _commandManager.BeginUpdate();
                foreach (CommandId commandId in commandIds)
                {
                    Command command = new Command(commandId);
                    commandManager.Add(command);
                    _loadedCommands.Add(command);
                }
            }
            catch (Exception)
            {
                Dispose();
                throw;
            }
            finally
            {
                _commandManager.EndUpdate();
            }
        }
 public void Dispose()
 {
     try
     {
         _commandManager.BeginUpdate();
         foreach (Command command in _loadedCommands)
         {
             _commandManager.Remove(command);
         }
         _loadedCommands.Clear();
     }
     finally
     {
         _commandManager.EndUpdate();
     }
 }
            public SizeCommand(CommandManager commandManager, CommandId widthId, CommandId heightId, int width, int height)
            {
                _widthId = widthId;
                _heightId = heightId;

                sizeValue = new Size(width, height);

                commandManager.BeginUpdate();

                commandManager.Add(
                    new SpinnerCommand(_widthId, MinSize.Width, MaxSize.Width, width, Increment, DecimalPlaces, RepresentativeString, FormatString),
                    command_ExecuteWithArgs);

                commandManager.Add(
                    new SpinnerCommand(_heightId, MinSize.Height, MaxSize.Height, height, Increment, DecimalPlaces, RepresentativeString, FormatString),
                    command_ExecuteWithArgs);

                commandManager.EndUpdate();
            }
 /// <summary>
 /// Ends update to CommandContextManager allowing multiple change events to be batched.
 /// </summary>
 public void EndUpdate()
 {
     commandManager.EndUpdate();
 }
        public HyperlinkForm(CommandManager commandManager, bool showAllOptions)
        {
            _slimOptions = !showAllOptions;
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();
            CommandManager = commandManager;
            buttonInsert.Text = Res.Get(StringId.InsertButtonText);
            buttonCancel.Text = Res.Get(StringId.CancelButton);
            label1.Text = Res.Get(StringId.UrlLabel);
            labelLinkText.Text = Res.Get(StringId.LinkTextLabel);
            labelTitle.Text = Res.Get(StringId.LinkTitleLabel);
            labelRel.Text = Res.Get(StringId.LinkRelLabel);
            ckboxNewWindow.Text = Res.Get(StringId.LinkNewWindowLabel);
            btnOptions.Text = " " + Res.Get(StringId.LinkLinkTo);
            btnOptions.AccessibleName = ControlHelper.ToAccessibleName(Res.Get(StringId.LinkLinkTo));
            btnOptionsToolTip.SetToolTip(this.btnOptions, Res.Get(StringId.LinkOptionsTooltip));
            btnRemove.Text = Res.Get(StringId.LinkRemoveLink);
            ckBoxGlossary.Text = Res.Get(StringId.LinkAddToGlossary);
            this.Text = Res.Get(StringId.LinkFormTitle);

            CommandManager.BeginUpdate();

            CommandManager.Add(new CommandGlossary());

            CommandManager.EndUpdate();

            textBoxAddress.GotFocus += new EventHandler(textBoxAddress_GotFocus);
            textBoxAddress.RightToLeft = System.Windows.Forms.RightToLeft.No;
            if (BidiHelper.IsRightToLeft)
                textBoxAddress.TextAlign = HorizontalAlignment.Right;
        }
        private void InitializeCommands()
        {
            _commandManager = _editorContext.CommandManager;
            _commandManager.BeginUpdate();

            InitializeSizeChunkCommands();
            InitializeAlignmentMarginChunkCommands();
            InitializeRotateChunkCommands();
            InitializeStylesChunkCommands();
            InitializePropertiesChunkCommands();
            InitializeSettingsChunkCommand();

            _commandManager.EndUpdate();
        }