コード例 #1
0
        public virtual int UpdateProperty(uint commandId, ref PropertyKey key, PropVariantRef currentValue, out PropVariant newValue)
        {
            Command command = ParentCommandManager.Get((CommandId)commandId);

            if (command == null)
            {
                return(NullCommandUpdateProperty(commandId, ref key, currentValue, out newValue));
            }

            try
            {
                newValue = new PropVariant();
                command.GetPropVariant(key, currentValue, ref newValue);

                if (newValue.IsNull())
                {
                    Trace.Fail("Didn't property update property for " + PropertyKeys.GetName(key) + " on command " + ((CommandId)commandId).ToString());

                    newValue = PropVariant.FromObject(currentValue.PropVariant.Value);
                }
            }
            catch (Exception ex)
            {
                Trace.Fail("Exception in UpdateProperty for " + PropertyKeys.GetName(key) + " on command " + commandId + ": " + ex);
                newValue = PropVariant.FromObject(currentValue.PropVariant.Value);
            }

            return(HRESULT.S_OK);
        }
コード例 #2
0
        public static Bitmap GetGalleryItemImageFromCommand(CommandManager commandManager, CommandId commandId)
        {
            // @RIBBON TODO: Deal with high constrast appropriately
            Command command = commandManager.Get(commandId);
            if (command != null)
                return command.LargeImage;

            return Images.Missing_LargeImage;
        }
コード例 #3
0
ファイル: RibbonHelper.cs プロジェクト: zcatt/OpenLiveWriter
        public static Bitmap GetGalleryItemImageFromCommand(CommandManager commandManager, CommandId commandId)
        {
            // @RIBBON TODO: Deal with high contrast appropriately
            Command command = commandManager.Get(commandId);

            if (command != null)
            {
                return(command.LargeImage);
            }

            return(Images.Missing_LargeImage);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        /// <summary>
        /// Gets the MenuItem for this MenuDefinitionEntry.
        /// </summary>
        /// <param name="commandManager">The CommandManager to use.</param>
        /// <param name="menuType">The MenuType.</param>
        /// <returns>The menu item for this MenuDefinitionEntry.</returns>
        protected override MenuItem GetMenuItem(CommandManager commandManager, MenuType menuType)
        {
            Command command = commandManager.Get(commandIdentifier);

            if (command == null || !command.On)
            {
                return(null);
            }
            if ((menuType == MenuType.Context || menuType == MenuType.CommandBarContext) && !command.VisibleOnContextMenu)
            {
                return(null);
            }

            //	Instantiate and initialize the CommandOwnerDrawMenuItem.
            CommandOwnerDrawMenuItem commandOwnerDrawMenuItem = new CommandOwnerDrawMenuItem(menuType, command, command.MenuText);

            return(commandOwnerDrawMenuItem);
        }
コード例 #6
0
        public HtmlMarginEditor(CommandManager commandManager)
        {
            // This call is required by the Windows Form Designer.
            InitializeComponent();

            marginCommand = (MarginCommand)commandManager.Get(CommandId.MarginsGroup);

            this.label3.Text = Res.Get(StringId.ImgSBMarginTop);
            this.label4.Text = Res.Get(StringId.ImgSBMarginRight);
            this.label5.Text = Res.Get(StringId.ImgSBMarginLeft);
            this.label6.Text = Res.Get(StringId.ImgSBMarginBottom);

            comboBoxMargins.Initialize();
            comboBoxMargins.SelectedIndexChanged += new EventHandler(comboBoxMargins_SelectedIndexChanged);
            comboBoxMargins.SelectedIndex = 0;
            panelCustomMargin.VisibleChanged += new EventHandler(panelCustomMargin_VisibleChanged);

            comboBoxMargins.AccessibleName = ControlHelper.ToAccessibleName(Res.Get(StringId.ImgSBMargins));

            marginCommand.MarginChanged += new EventHandler(marginCommand_MarginChanged);
        }
コード例 #7
0
        /// <summary>
        /// Gets the MenuItem for this MenuDefinitionEntry.
        /// </summary>
        /// <param name="commandManager">The CommandManager to use.</param>
        /// <param name="menuType">The MenuType.</param>
        /// <returns>The menu item for this MenuDefinitionEntry.</returns>
        protected override MenuItem GetMenuItem(CommandManager commandManager, MenuType menuType)
        {
            Command command = commandManager.Get(commandIdentifier);
            if (command == null || !command.On)
                return null;
            if ((menuType == MenuType.Context || menuType == MenuType.CommandBarContext) && !command.VisibleOnContextMenu)
                return null;

            //	Instantiate and initialize the CommandOwnerDrawMenuItem.
            CommandOwnerDrawMenuItem commandOwnerDrawMenuItem = new CommandOwnerDrawMenuItem(menuType, command, command.MenuText);
            return commandOwnerDrawMenuItem;
        }
コード例 #8
0
 /// <summary>
 /// Must be called by inheriting classes to avoid null references!
 /// </summary>
 /// <param name="commandManager"></param>
 protected void InitializeAlignmentMarginCommands(CommandManager commandManager)
 {
     _marginCommand = (MarginCommand)commandManager.Get(CommandId.MarginsGroup);
     _alignmentCommand = (AlignmentCommand)commandManager.Get(CommandId.AlignmentGallery);
 }