private void OnServiceChanged() { try { isServiceUpdating = true; string selectedName = SelectedName; SourceNames.Clear(); bool isSelectedNameContained = false; void Add(string name) { if (!isSelectedNameContained) { isSelectedNameContained = name == selectedName; } SourceNames.Add(name); } if (service.All.Count > 1) { Add(AllFeedName); } foreach (IPackageSource source in service.All) { Add(source.Name); } if (isSelectedNameContained) { SelectedName = selectedName; } else if (service.Primary != null) { SelectedName = SourceNames.FirstOrDefault(s => string.Equals(s, service.Primary.Name, StringComparison.CurrentCultureIgnoreCase)); } else { SelectedName = SourceNames.FirstOrDefault(); } } finally { isServiceUpdating = false; } }
private void OnServiceChanged() { string selectedName = SelectedName; SourceNames.Clear(); bool isSelectedNameContained = false; void Add(string name) { if (!isSelectedNameContained) { isSelectedNameContained = name == selectedName; } SourceNames.Add(name); } if (service.All.Count > 1) { Add(AllFeedName); } foreach (IPackageSource source in service.All) { Add(source.Name); } if (isSelectedNameContained) { SelectedName = selectedName; } else if (service.Primary != null) { SelectedName = SourceNames.FirstOrDefault(s => s == service.Primary.Name); } else { SelectedName = SourceNames.FirstOrDefault(); } }