/// <summary>
        /// Adds the img button.
        /// </summary>
        /// <param name="aCommandUrlSequence">A command URLs e.g. "macro:///Standard.Module1.myMacro()"</param>
        /// <param name="aGraphicSequence">A graphics for the Button. Use the <code>XImgMgr</code> to retrieve or register the image.</param>
        /// <param name="itemLabelSequence">The item labels.</param>
        /// <param name="dublicate">Set <code>true</code> if you want to add this button even if the commandUrl allready exist in the ToolBar</param>
        /// <param name="index"> </param>
        /// <param name="buttonType"> </param>
        /// <param name="nImageType">Type of the images. Standard is 0</param>
        /// <returns></returns>
        public bool AddImgButton(string[] aCommandUrlSequence, XGraphic[] aGraphicSequence, string[] itemLabelSequence, bool dublicate = false,
                                 int[] index = null, OO.PropertyControlType buttonType = 0, short nImageType = 0)
        {
            if (XImgMgr == null) return false;

            XImgMgr.insertImages(nImageType, aCommandUrlSequence, aGraphicSequence);

            for (int i = 0; i < aCommandUrlSequence.Length; i++)
            {
                if (!dublicate && ButtonAllreadyExists(aCommandUrlSequence[i]))
                    continue;

                int z = GetIndex(index, i);

                // Creates the PropertyValue set for the toolbar
                PropertyValue[] toolbarItemProperty = SetItemProperty(aCommandUrlSequence[i], itemLabelSequence[i],
                                                                      buttonType);

                // Adds the new toolbar to the toolbar container
                Settings.insertByIndex(z, Any.GetAsOne(toolbarItemProperty));
            }

            StoreSettings();

            return true;
        }
Пример #2
0
 /// <summary>
 /// Adds an image button to the ToolBar.
 /// </summary>
 /// <param name="aCommandUrl">A command URL e.g. "macro:///Standard.Module1.myMacro()"</param>
 /// <param name="aGraphic">A graphic for the Button. Use the <code>XImgMgr</code> to retrieve or register the image.</param>
 /// <param name="itemLabel">The item label.</param>
 /// <param name="dublicate">Set <code>true</code> if you want to add this button even if the commandUrl allready exist in the ToolBar</param>
 /// <param name="index">Index for the position of the Button. Postitive value means normal index, negative value means position from the the end of all buttons, <code>-0</code> means at the and of the list. </param>
 /// <param name="buttonType"> </param>
 /// <param name="nImageType">Type of the image. Standard is 0</param>
 /// <returns></returns>
 public bool AddImgButton(string aCommandUrl, XGraphic aGraphic, string itemLabel, bool dublicate = false, int index = -0,
                          OO.PropertyControlType buttonType = 0, short nImageType = 0)
 {
     return(AddImgButton(new[] { aCommandUrl }, new[] { aGraphic }, new[] { itemLabel }, dublicate, new[] { index },
                         buttonType, nImageType));
 }
 /// <summary>
 /// Adds an image button to the ToolBar.
 /// </summary>
 /// <param name="aCommandUrl">A command URL e.g. "macro:///Standard.Module1.myMacro()"</param>
 /// <param name="aGraphic">A graphic for the Button. Use the <code>XImgMgr</code> to retrieve or register the image.</param>
 /// <param name="itemLabel">The item label.</param>
 /// <param name="dublicate">Set <code>true</code> if you want to add this button even if the commandUrl allready exist in the ToolBar</param>
 /// <param name="index">Index for the position of the Button. Postitive value means normal index, negative value means position from the the end of all buttons, <code>-0</code> means at the and of the list. </param>
 /// <param name="buttonType"> </param>
 /// <param name="nImageType">Type of the image. Standard is 0</param>
 /// <returns></returns>
 public bool AddImgButton(string aCommandUrl, XGraphic aGraphic, string itemLabel, bool dublicate = false, int index = -0,
                          OO.PropertyControlType buttonType = 0, short nImageType = 0)
 {
     return AddImgButton(new[] { aCommandUrl }, new[] { aGraphic }, new[] { itemLabel }, dublicate, new[] { index },
                         buttonType, nImageType);
 }