void UncheckExistingCheckedPackageWithDifferentVersion(ManagePackagesSearchResultViewModel packageViewModel) { ManagePackagesSearchResultViewModel existingPackageViewModel = GetExistingCheckedPackageViewModel(packageViewModel.Id); if (existingPackageViewModel != null) { CheckedPackageViewModels.Remove(existingPackageViewModel); existingPackageViewModel.IsChecked = false; } }
void UpdatePackageViewModelIfPreviouslyChecked(ManagePackagesSearchResultViewModel packageViewModel) { ignorePackageCheckedChanged = true; try { ManagePackagesSearchResultViewModel existingPackageViewModel = GetExistingCheckedPackageViewModel(packageViewModel.Id); if (existingPackageViewModel != null) { packageViewModel.UpdateFromPreviouslyCheckedViewModel(existingPackageViewModel); CheckedPackageViewModels.Remove(existingPackageViewModel); CheckedPackageViewModels.Add(packageViewModel); } } finally { ignorePackageCheckedChanged = false; } }
public void OnPackageCheckedChanged(ManagePackagesSearchResultViewModel packageViewModel) { if (ignorePackageCheckedChanged) { return; } if (packageViewModel.IsChecked) { UncheckExistingCheckedPackageWithDifferentVersion(packageViewModel); CheckedPackageViewModels.Add(packageViewModel); } else { CheckedPackageViewModels.Remove(packageViewModel); } }
void UpdateRecentPackages() { if (SelectedPackageSource == null) { return; } if (CheckedPackageViewModels.Any()) { foreach (ManagePackagesSearchResultViewModel packageViewModel in CheckedPackageViewModels) { recentPackagesRepository.AddPackage(packageViewModel, SelectedPackageSource.Name); } } else { recentPackagesRepository.AddPackage(SelectedPackage, SelectedPackageSource.Name); } }
ManagePackagesSearchResultViewModel GetExistingCheckedPackageViewModel(string packageId) { return(CheckedPackageViewModels .FirstOrDefault(item => item.Id == packageId)); }