コード例 #1
0
        private void imageDecoratorCommand_Execute(object sender, EventArgs e)
        {
            using (IUndoUnit undo = _editorContext.CreateUndoUnit())
            {
                ImageDecorator imageDecorator = ((ImageDecorator)((Command)sender).Tag);

                //perform the execution so that the decorator is added to the list of active decorators
                imageDecorator.Command.PerformExecute();

                //since this command was invoked explicitly via a command button, display the editor dialog.
                object state = null;
                if (imageDecorator.Id == CropDecorator.Id)
                {
                    state = ImagePropertiesInfo.Image;
                }

                using (state as IDisposable)
                {
                    DialogResult result = ImageDecoratorHelper.ShowImageDecoratorEditorDialog(imageDecorator,
                                                                                              ImagePropertiesInfo, new ApplyDecoratorCallback(ApplyImageDecorations),
                                                                                              _editorContext, state, _imageEditingContext, _imageEditingContext.DecoratorsManager.CommandManager);

                    if (result == DialogResult.OK)
                    {
                        undo.Commit();
                    }
                }
            }
        }
コード例 #2
0
        private void commandImageDecorator_Execute(object sender, EventArgs e)
        {
            ImageDecorator imageDecorator = ((ImageDecorator)((Command)sender).Tag);

            //perform the execution so that the decorator is added to the list of active decorators
            imageDecorator.Command.PerformExecute();

            //since this command was invoked explicitly via a command button, display the editor dialog.
            ImageDecoratorHelper.ShowImageDecoratorEditorDialog(FindForm(), imageDecorator, ImageInfo, new ApplyDecoratorCallback(ApplyImageDecorations));
        }