private void InitializeCommands()
        {
            commandContextManager = new CommandContextManager(_decoratorsManager.CommandManager);
            commandContextManager.BeginUpdate();

            commandAddMenu = new Command(CommandId.AddDecorator);
            _decoratorsManager.CommandManager.Add(commandAddMenu);
            addCommandContextMenuDefinition = new CommandContextMenuDefinition(components);
            if (_decoratorsManager != null)
            {
                for (int i = 0; i < _decoratorsManager.ImageDecoratorGroups.Length; i++)
                {
                    ImageDecoratorGroup imageDecoratorGroup = _decoratorsManager.ImageDecoratorGroups[i];

                    foreach (ImageDecorator imageDecorator in imageDecoratorGroup.ImageDecorators)
                    {
                        if (!imageDecorator.IsHidden) //don't show hidden decorators in the command list
                        {
                            Command ImageDecoratorApplyCommand = imageDecorator.Command;
                            MenuDefinitionEntryCommand imageDecoratorMenuEntry = new MenuDefinitionEntryCommand(components);
                            imageDecoratorMenuEntry.CommandIdentifier = ImageDecoratorApplyCommand.Identifier;
                            addCommandContextMenuDefinition.Entries.Add(imageDecoratorMenuEntry);

                            ImageDecoratorApplyCommand.Execute += new EventHandler(imageDecoratorApplyCommand_Execute);
                            ImageDecoratorApplyCommand.Tag      = imageDecorator.Id;
                        }
                    }
                }
            }

            commandImageRemove          = new Command(CommandId.RemoveDecorator);
            commandImageRemove.Execute += new EventHandler(commandRemoveMenu_Execute);
            commandContextManager.AddCommand(commandImageRemove, CommandContext.Normal);

            _decoratorsManager.CommandManager.SuppressEvents = true;
            try
            {
                commandContextManager.EndUpdate();
            }
            finally
            {
                _decoratorsManager.CommandManager.SuppressEvents = true;
            }
        }
Beispiel #2
0
        private void InitializeCommands()
        {
            commandContextManager = new CommandContextManager(CommandManager);
            commandContextManager.BeginUpdate();

            for (int i = 0; i < ImageDecoratorGroups.Length; i++)
            {
                ImageDecoratorGroup imageDecoratorGroup = ImageDecoratorGroups[i];
                foreach (ImageDecorator imageDecorator in imageDecoratorGroup.ImageDecorators)
                {
                    Command ImageDecoratorApplyCommand = new Command(CommandId.ImageDecoratorApply);
                    ImageDecoratorApplyCommand.Identifier += imageDecorator.Id;
                    ImageDecoratorApplyCommand.Text        = imageDecorator.DecoratorName;
                    ImageDecoratorApplyCommand.MenuText    = imageDecorator.DecoratorName;
                    imageDecorator.SetCommand(ImageDecoratorApplyCommand);
                    commandContextManager.AddCommand(ImageDecoratorApplyCommand, CommandContext.Normal);

                    ImageDecoratorApplyCommand.Execute += new EventHandler(imageDecoratorCommand_Execute);
                    ImageDecoratorApplyCommand.Tag      = imageDecorator.Id;
                }
            }

            commandContextManager.EndUpdate();
        }
        private void InitializeCommands()
        {
            commandContextManager = new CommandContextManager(ApplicationManager.CommandManager);
            commandContextManager.BeginUpdate();

            commandImageBrightness          = new CommandImageBrightness(components);
            commandImageBrightness.Tag      = _imageDataContext.DecoratorsManager.GetImageDecorator(BrightnessDecorator.Id);
            commandImageBrightness.Execute += new EventHandler(commandImageDecorator_Execute);
            commandContextManager.AddCommand(commandImageBrightness, CommandContext.Normal);

            commandImageRotate          = new CommandImageRotate(components);
            commandImageRotate.Execute += new EventHandler(commandImageRotate_Execute);
            commandContextManager.AddCommand(commandImageRotate, CommandContext.Normal);

            commandImageReset          = new CommandImageReset(components);
            commandImageReset.Execute += new EventHandler(commandImageReset_Execute);
            commandContextManager.AddCommand(commandImageReset, CommandContext.Normal);

            commandImageSaveDefaults          = new CommandImageSaveDefaults(components);
            commandImageSaveDefaults.Execute += new EventHandler(commandImageSaveDefaults_Execute);
            commandContextManager.AddCommand(commandImageSaveDefaults, CommandContext.Normal);

            commandContextManager.EndUpdate();
        }