示例#1
0
        /// <summary>Gets the context menu.</summary>
        /// <param name="requestEventArgs">Request parameters.</param>
        /// <returns>Context menu for specified location.</returns>
        public override ContextMenuStrip GetContextMenu(ItemContextMenuRequestEventArgs requestEventArgs)
        {
            ContextMenuStrip menu = null;

            if (Repository != null)
            {
                menu = new ContextMenuStrip();
                menu.Items.Add(GuiItemFactory.GetRefreshReferencesItem <ToolStripMenuItem>(Repository, DataContext, Resources.StrRefresh));
                switch (DataContext)
                {
                case ReferenceType.LocalBranch:
                    menu.Items.Add(GuiItemFactory.GetCreateBranchItem <ToolStripMenuItem>(Repository));
                    break;

                case ReferenceType.RemoteBranch:
                    menu.Items.Add(GuiItemFactory.GetAddRemoteItem <ToolStripMenuItem>(Repository));
                    break;

                case ReferenceType.Tag:
                    menu.Items.Add(GuiItemFactory.GetCreateTagItem <ToolStripMenuItem>(Repository));
                    break;
                }
            }
            if (menu != null)
            {
                Utility.MarkDropDownForAutoDispose(menu);
            }
            return(menu);
        }