void commandInsertablePlugins_ExecuteWithArgs(object sender, ExecuteEventHandlerArgs args)
        {
            string  pluginId = commandInsertablePlugins.Items[args.GetInt(commandInsertablePlugins.CommandId.ToString())].Cookie;
            Command command  = CommandManager.Get(pluginId);

            command.PerformExecute();
        }
 protected override void PerformExecuteWithArgs(CommandExecutionVerb verb, ExecuteEventHandlerArgs args)
 {
     if (_allowPreview || verb == CommandExecutionVerb.Execute)
     {
         base.PerformExecuteWithArgs(verb, args);
     }
 }
        void commandSemanticHtml_ExecuteWithArgs(object sender, ExecuteEventHandlerArgs args)
        {
            int selectedIndex          = args.GetInt(CommandId.SemanticHtmlGallery.ToString());
            IHtmlFormattingStyle style = commandSemanticHtml.Items[selectedIndex] as IHtmlFormattingStyle;

            ApplyHtmlFormattingStyle(style);
        }
 void commandSelectBlog_ExecuteWithArgs(object sender, ExecuteEventHandlerArgs args)
 {
     if (WeblogSelected != null)
     {
         WeblogSelected(BlogSettings.GetBlogs(true)[commandSelectBlog.SelectedIndex].Id);
     }
 }
Exemple #5
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();
        }
Exemple #6
0
 void RecentItemsCommand_ExecuteWithArgs(object sender, ExecuteEventHandlerArgs args)
 {
     selectedIndex = args.GetInt(CommandId.ToString());
     if (selectedIndex != INVALID_INDEX && selectedIndex < postInfo.Count)
     {
         WindowCascadeHelper.SetNextOpenedLocation(postEditingSite.FrameWindow.Location);
         postEditingSite.OpenLocalPost(postInfo[selectedIndex]);
     }
 }
Exemple #7
0
        void AlignmentCommand_ExecuteWithArgs(object sender, ExecuteEventHandlerArgs args)
        {
            int newSelectedIndex = args.GetInt(CommandId.ToString());

            SetSelectedItem(Items[newSelectedIndex].Cookie);

            if (AlignmentChanged != null)
            {
                AlignmentChanged(this, EventArgs.Empty);
            }
        }
        protected override void OnExecute(ExecuteEventHandlerArgs args)
        {
            selectedIndex = args.GetInt(CommandId.ToString());
            if (AllowExecuteOnInvalidIndex || selectedIndex != INVALID_INDEX)
            {
                base.OnExecute(new ExecuteEventHandlerArgs(CommandId.ToString(), selectedIndex));
            }

            if (!AllowSelection)
            {
                Invalidate();
            }

            OnStateChanged(EventArgs.Empty);
        }
        public void Dispatch(PropertyKey key, ExecuteEventHandlerArgs args)
        {
            ExecuteWithArgsDelegate executeWithArgsDelegate = commands[key] as ExecuteWithArgsDelegate;

            if (executeWithArgsDelegate != null)
            {
                executeWithArgsDelegate(args);
                return;
            }

            CommandId commandId = (CommandId)commands[key];
            Command   command   = CommandManager.Get(commandId);

            command.PerformExecuteWithArgs(args);
        }
            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();
            }
        public void FireStartPreview(ExecuteEventHandlerArgs args)
        {
            if (undoUnit == null)
            {
                undoUnit = CreateInvisibleUndoUnit();
                Debug.Assert(undoUnit != null, "You haven't provided a way for " + CommandId + " to create undo units.  Won't work.");
            }

            if (!_inPreview)
            {
                _inPreview = true;
                if (OnStartPreview != null)
                {
                    OnStartPreview(this, EventArgs.Empty);
                }
            }

            Preview(args);
        }
Exemple #12
0
        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();
                }
            }
        }
        protected override void PerformExecuteWithArgs(CommandExecutionVerb verb, ExecuteEventHandlerArgs args)
        {
            switch (verb)
            {
            case CommandExecutionVerb.Execute:
                PerformExecuteWithArgs(args);
                break;

            case CommandExecutionVerb.Preview:
                FireStartPreview(args);
                break;

            case CommandExecutionVerb.CancelPreview:
                FireCancelPreview();
                break;

            default:
                Debug.Fail("Unexpected CommandExecutionVerb!");
                break;
            }
        }
Exemple #14
0
        void imageEffectsGalleryCommand_ExecuteWithArgs(object sender, ExecuteEventHandlerArgs args)
        {
            ImageEffectsGalleryCommand galleryCommand = (ImageEffectsGalleryCommand)sender;
            int            newSelectedIndex           = args.GetInt(galleryCommand.CommandId.ToString());
            string         newDecoratorId             = galleryCommand.Items[newSelectedIndex].Cookie;
            ImageDecorator newDecorator = _imageEditingContext.DecoratorsManager.GetImageDecorator(newDecoratorId);

            Debug.Assert(newDecorator != null);

            if (galleryCommand.SelectedItem != newDecorator.Id)
            {
                ImagePropertiesInfo.ImageDecorators.AddDecorator(newDecorator);

                if (!ImagePropertiesInfo.IsEditableEmbeddedImage())
                {
                    // If this is a web image, calling ApplyImageDecorations will keep properties up to date but won't
                    // actually do any decorating, so do it manually. Only borders should be manually decorated.
                    SimpleImageDecoratorContext context = new SimpleImageDecoratorContext(ImagePropertiesInfo);
                    newDecorator.Decorate(context);
                }

                ApplyImageDecorations();
            }
        }
 protected virtual void Preview(ExecuteEventHandlerArgs args)
 {
     PerformExecuteWithArgs(args);
 }
 protected override void PerformExecuteWithArgs(CommandExecutionVerb verb, ExecuteEventHandlerArgs args)
 {
     _command.PerformExecuteWithArgs(args);
 }