void backworkerFetchProjecs_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { ResolveControlsStatus(false); if (OriginalJiraProjects != null) { foreach (var project in OriginalJiraProjects) { ForSelectedJiraProjects.Add(project); SearchSource.Add(project); } if (SelectedJiraProjects != null) { foreach (var project in SelectedJiraProjects) { var index = ForSelectedJiraProjects.FindIndex( p => p.Name.Equals(project.Name, StringComparison.InvariantCultureIgnoreCase)); if (index > -1) { ForSelectedJiraProjects.RemoveAt(index); SearchSource.RemoveAt(index); } } } } RebindingDataSource(); }
private void btnSelect_Click(object sender, EventArgs e) { var selectedItem = lsbSourceProjects.SelectedItems; if (selectedItem.Count > 0) { foreach (var item in selectedItem) { var project = item as JiraProject; SelectedJiraProjects.Add(project); var forIndex = ForSelectedJiraProjects.IndexOf(project); var searchIndex = SearchSource.IndexOf(project); if (forIndex != -1) { ForSelectedJiraProjects.RemoveAt(forIndex); } if (searchIndex != -1) { SearchSource.RemoveAt(searchIndex); } } RebindingDataSource(); } }