Пример #1
0
        /// <summary>
        /// Helper method to add a MenuItem to the Greenshot context menu
        /// </summary>
        /// <param name="imageEditor"></param>
        /// <param name="item"></param>
        public static void AddToContextMenu(IGreenshotPluginHost host, ToolStripMenuItem item)
        {
            // Here we can hang ourselves to the main context menu!
            ContextMenuStrip contextMenu = host.MainMenu;
            bool addedItem = false;

            // Try to find a separator, so we insert ourselves after it
            for(int i=0; i < contextMenu.Items.Count; i++) {
                if (contextMenu.Items[i].GetType() == typeof(ToolStripSeparator)) {
                    contextMenu.Items.Insert(i+1, item);
                    addedItem = true;
                    break;
                }
            }
            // If we didn't insert the item, we just add it...
            if (!addedItem) {
                contextMenu.Items.Add(item);
            }
        }
Пример #2
0
        /// <summary>
        /// Helper method to add a MenuItem to the Greenshot context menu
        /// </summary>
        /// <param name="imageEditor"></param>
        /// <param name="item"></param>
        public static void AddToContextMenu(IGreenshotPluginHost host, ToolStripMenuItem item)
        {
            // Here we can hang ourselves to the main context menu!
            ContextMenuStrip contextMenu = host.MainMenu;
            bool             addedItem   = false;

            // Try to find a separator, so we insert ourselves after it
            for (int i = 0; i < contextMenu.Items.Count; i++)
            {
                if (contextMenu.Items[i].GetType() == typeof(ToolStripSeparator))
                {
                    contextMenu.Items.Insert(i + 1, item);
                    addedItem = true;
                    break;
                }
            }
            // If we didn't insert the item, we just add it...
            if (!addedItem)
            {
                contextMenu.Items.Add(item);
            }
        }
Пример #3
0
 public virtual bool Initialize(IGreenshotPluginHost pluginHost, ICaptureHost captureHost, PluginAttribute myAttributes)
 {
     this.host = pluginHost;
     this.captureHost = captureHost;
     FogbugzPlugin.FogbugzPluginAttribute = myAttributes;
     this.host.OnImageEditorOpen += new OnImageEditorOpenHandler(this.ImageEditorOpened);
     this.config = IniConfig.GetIniSection<FogBugzConfiguration>();
     return true;
 }