private GitCommandEntry CreateGitCommandEntry(GitContextMenuCommand gitCommand)
        {
            GitCommandEntry gitCommandEntry = new GitCommandEntry(gitCommand);

            gitCommandEntry.Action  += GitCommandEntry_Action;
            gitCommandEntry.Changed += GitCommandEntry_Changed;
            return(gitCommandEntry);
        }
        private void ButtonGitContextMenuCommandsAdd_Click(object sender, EventArgs e)
        {
            GitCommandEntry gitCommandEntry = CreateGitCommandEntry(new GitContextMenuCommand());

            _gitCommands.Add(gitCommandEntry);
            flowLayoutPanelGitContextMenuCommands.Controls.Add(gitCommandEntry);
            UpdateFlowLayoutPanelSize(flowLayoutPanelGitContextMenuCommands);
            _gitCommandsChanged = true;
        }
        private void MoveGitCommandEntry(GitCommandEntry gitCommandEntry, int adjustment)
        {
            if (adjustment == 0)
            {
                return;
            }

            int index = _gitCommands.IndexOf(gitCommandEntry);

            if (index < 0)
            {
                return;
            }

            int newIndex = index + adjustment;

            newIndex = newIndex < 0 ? 0 : newIndex;
            newIndex = newIndex >= _gitCommands.Count ? _gitCommands.Count - 1 : newIndex;
            flowLayoutPanelGitContextMenuCommands.Controls.SetChildIndex(gitCommandEntry, newIndex + 1);
            _gitCommands.RemoveAt(index);
            _gitCommands.Insert(newIndex, gitCommandEntry);
        }
 private void DisposeGitCommandEntry(GitCommandEntry gitCommandEntry)
 {
     gitCommandEntry.Action  -= GitCommandEntry_Action;
     gitCommandEntry.Changed -= GitCommandEntry_Changed;
     gitCommandEntry.Dispose();
 }