Пример #1
0
        void commandMargin_ExecuteWithArgs(object sender, ExecuteEventHandlerArgs args)
        {
            Command command = (Command)sender;

            int value = Convert.ToInt32(args.GetDecimal(command.CommandId.ToString()));
            Debug.WriteLine(command.LabelTitle + ": " + value);

            if (command.CommandId == commandLeftMargin.CommandId)
            {
                marginValue.Left = value;
                commandLeftMargin.Value = value;
            }
            else if (command.CommandId == commandRightMargin.CommandId)
            {
                marginValue.Right = value;
                commandRightMargin.Value = value;
            }
            else if (command.CommandId == commandBottomMargin.CommandId)
            {
                marginValue.Bottom = value;
                commandBottomMargin.Value = value;
            }
            else if (command.CommandId == commandTopMargin.CommandId)
            {
                marginValue.Top = value;
                commandTopMargin.Value = value;
            }

            FireMarginChanged();
        }
            void command_ExecuteWithArgs(object sender, ExecuteEventHandlerArgs args)
            {
                Command command = (Command)sender;
                Debug.Assert(command.CommandId == _widthId || command.CommandId == _heightId);

                int value = Convert.ToInt32(args.GetDecimal(command.CommandId.ToString()));

                if (command.CommandId == _widthId)
                {
                    sizeValue.Width = value;
                }
                else if (command.CommandId == _heightId)
                {
                    sizeValue.Height = value;
                }

                FireSizeChanged();
            }
        void imageSizeCommand_ExecuteWithArgs(object sender, ExecuteEventHandlerArgs args)
        {
            SpinnerCommand command = (SpinnerCommand)sender;
            int newValue = Convert.ToInt32(args.GetDecimal(command.CommandId.ToString()));

            using (IUndoUnit undo = _editorContext.CreateUndoUnit())
            {
                if (command.CommandId == CommandId.FormatImageAdjustWidth && newValue != ImagePropertiesInfo.InlineImageWidth)
                {
                    ImagePropertiesInfo.InlineImageWidth = newValue;
                    ApplyImageDecorations(ImagePropertyType.InlineSize, ImageDecoratorInvocationSource.Command);
                    undo.Commit();
                }
                else if (command.CommandId == CommandId.FormatImageAdjustHeight && newValue != ImagePropertiesInfo.InlineImageHeight)
                {
                    ImagePropertiesInfo.InlineImageHeight = newValue;
                    ApplyImageDecorations(ImagePropertyType.InlineSize, ImageDecoratorInvocationSource.Command);
                    undo.Commit();
                }
            }
        }