/// <summary> /// Delete selected repository and optionally more files (if a single repo is selected) /// If multiple repos are selected, simply remove them from our list. /// </summary> private void MenuDeleteRepoClick(object sender, EventArgs e) { if (listRepos.SelectedItems.Count > 1) { // Remove every selected repo from the list foreach (int index in listRepos.SelectedIndices) { ListViewItem li = listRepos.Items[index]; ClassRepo r = li.Tag as ClassRepo; App.Repos.Delete(r); } MenuRefreshClick(null, null); // Heavy refresh } else { // Single selected repo offers more deletion choices... ClassRepo repo = GetSelectedRepo(); // The actual file deletion is implemented in FormDeleteRepo form class: FormDeleteRepo deleteRepo = new FormDeleteRepo(repo.Path); if (deleteRepo.ShowDialog() == DialogResult.OK) { App.Repos.Delete(repo); MenuRefreshClick(null, null); // Heavy refresh } } }
/// <summary> /// Delete selected repository and optionally more files (if a single repo is selected) /// If multiple repos are selected, simply remove them from our list. /// </summary> private void MenuDeleteRepoClick(object sender, EventArgs e) { if( listRepos.SelectedItems.Count>1) { // Remove every selected repo from the list foreach (int index in listRepos.SelectedIndices) { ListViewItem li = listRepos.Items[index]; ClassRepo r = li.Tag as ClassRepo; App.Repos.Delete(r); } MenuRefreshClick(null, null); // Heavy refresh } else { // Single selected repo offers more deletion choices... ClassRepo repo = GetSelectedRepo(); // The actual file deletion is implemented in FormDeleteRepo form class: FormDeleteRepo deleteRepo = new FormDeleteRepo(repo.Root); if (deleteRepo.ShowDialog() == DialogResult.OK) { App.Repos.Delete(repo); MenuRefreshClick(null, null); // Heavy refresh } } }