示例#1
0
        private void RemoveSelectedBranches(ListView activeListview)
        {
            if (activeListview != null && activeListview.SelectedItems != null)
            {
                foreach (ListViewItem item in activeListview.SelectedItems)
                {
                    // Remove CURRENT!  Are you sure!
                    if (string.Compare(item.Text, "Current", true) == 0)
                    {
                        if (MOG_Prompt.PromptMessage("Remove branch", "'Current' is a system defined branch that cannot be removed!"))
                        {
                            continue;
                        }
                    }

                    string message = "Are you sure you want to remove this branch or tag?\n" +
                                     "BRANCH: " + item.Text;
                    if (MOG_Prompt.PromptResponse("Remove branch/tag?", message, MOGPromptButtons.YesNo) == MOGPromptResult.Yes)
                    {
                        // Remove the branch
                        if (MOG_ControllerProject.BranchRemove(item.Text))
                        {
//TODO - We really shouldn't purge the branch right now but rather show the removed branches in red and allow the user to purge them later
                            // Also purge this branch now
                            if (MOG_ControllerProject.BranchPurge(item.Text))
                            {
                                item.Remove();
                            }
                        }
                        else
                        {
                            MOG_Prompt.PromptMessage("Error in remove branch/tag", "Branch/Tag ( " + item.Text + " ) was not able to be removed!");
                        }
                    }
                }
            }
        }