Exemplo n.º 1
0
        private GitCommandEntry CreateGitCommandEntry(GitContextMenuCommand gitCommand)
        {
            GitCommandEntry gitCommandEntry = new GitCommandEntry(gitCommand);

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

            _gitCommands.Add(gitCommandEntry);
            flowLayoutPanelGitContextMenuCommands.Controls.Add(gitCommandEntry);
            UpdateFlowLayoutPanelSize(flowLayoutPanelGitContextMenuCommands);
            _gitCommandsChanged = true;
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
 private void DisposeGitCommandEntry(GitCommandEntry gitCommandEntry)
 {
     gitCommandEntry.Action  -= GitCommandEntry_Action;
     gitCommandEntry.Changed -= GitCommandEntry_Changed;
     gitCommandEntry.Dispose();
 }