private void CreateProjectList() { _projects = new List<PackageInstallationInfo>(); if (SelectedAction == Resources.Resources.Action_Consolidate) { // project list contains projects that have the package installed. // The project with the same version installed is included, but disabled. foreach (var project in Solution.Projects) { var installed = project.InstalledPackages.GetInstalledPackage(Id); if (installed != null) { var enabled = installed.Identity.Version != SelectedVersion.Version; var info = new PackageInstallationInfo(project, installed.Identity.Version, enabled); _projects.Add(info); } } } else if (SelectedAction == Resources.Resources.Action_Update) { // project list contains projects/solution that have the package // installed. The project/solution with the same version installed // is included, but disabled. foreach (var project in Solution.Projects) { var installed = project.InstalledPackages.GetInstalledPackage(Id); if (installed != null) { var enabled = installed.Identity.Version != SelectedVersion.Version; var info = new PackageInstallationInfo(project, installed.Identity.Version, enabled); _projects.Add(info); } } var v = Solution.InstalledPackages.GetInstalledPackage(Id); if (v != null) { var enabled = v.Identity.Version != SelectedVersion.Version; var info = new PackageInstallationInfo( Solution.Name, SelectedVersion.Version, enabled, Solution.Projects.First()); _projects.Add(info); } } else if (SelectedAction == Resources.Resources.Action_Install) { // project list contains projects that do not have the package installed. foreach (var project in Solution.Projects) { var installed = project.InstalledPackages.GetInstalledPackage(Id); if (installed == null) { var info = new PackageInstallationInfo(project, null, enabled: true); _projects.Add(info); } } } else if (SelectedAction == Resources.Resources.Action_Uninstall) { // project list contains projects/solution that have the same version installed. foreach (var project in Solution.Projects) { var installed = project.InstalledPackages.GetInstalledPackage(Id); if (installed != null && installed.Identity.Version == SelectedVersion.Version) { var info = new PackageInstallationInfo(project, installed.Identity.Version, enabled: true); _projects.Add(info); } } var v = Solution.InstalledPackages.GetInstalledPackage(Id); if (v != null) { var enabled = v.Identity.Version == SelectedVersion.Version; var info = new PackageInstallationInfo( Solution.Name, SelectedVersion.Version, enabled, Solution.Projects.First()); _projects.Add(info); } } foreach (var p in _projects) { p.SelectedChanged += (sender, e) => { ActionEnabled = _projects.Any(i => i.Selected); }; } ActionEnabled = _projects.Any(i => i.Selected); OnPropertyChanged("Projects"); }
private void CreateProjectList() { _projects = new List <PackageInstallationInfo>(); if (SelectedAction == Resources.Resources.Action_Consolidate) { // project list contains projects that have the package installed. // The project with the same version installed is included, but disabled. foreach (var project in Solution.Projects) { var installed = project.InstalledPackages.GetInstalledPackage(Id); if (installed != null) { var enabled = installed.Identity.Version != SelectedVersion.Version; var info = new PackageInstallationInfo(project, installed.Identity.Version, enabled); _projects.Add(info); } } } else if (SelectedAction == Resources.Resources.Action_Update) { // project list contains projects/solution that have the package // installed. The project/solution with the same version installed // is included, but disabled. foreach (var project in Solution.Projects) { var installed = project.InstalledPackages.GetInstalledPackage(Id); if (installed != null) { var enabled = installed.Identity.Version != SelectedVersion.Version; var info = new PackageInstallationInfo(project, installed.Identity.Version, enabled); _projects.Add(info); } } var v = Solution.InstalledPackages.GetInstalledPackage(Id); if (v != null) { var enabled = v.Identity.Version != SelectedVersion.Version; var info = new PackageInstallationInfo( Solution.Name, SelectedVersion.Version, enabled, Solution.Projects.First()); _projects.Add(info); } } else if (SelectedAction == Resources.Resources.Action_Install) { // project list contains projects that do not have the package installed. foreach (var project in Solution.Projects) { var installed = project.InstalledPackages.GetInstalledPackage(Id); if (installed == null) { var info = new PackageInstallationInfo(project, null, enabled: true); _projects.Add(info); } } } else if (SelectedAction == Resources.Resources.Action_Uninstall) { // project list contains projects/solution that have the same version installed. foreach (var project in Solution.Projects) { var installed = project.InstalledPackages.GetInstalledPackage(Id); if (installed != null && installed.Identity.Version == SelectedVersion.Version) { var info = new PackageInstallationInfo(project, installed.Identity.Version, enabled: true); _projects.Add(info); } } var v = Solution.InstalledPackages.GetInstalledPackage(Id); if (v != null) { var enabled = v.Identity.Version == SelectedVersion.Version; var info = new PackageInstallationInfo( Solution.Name, SelectedVersion.Version, enabled, Solution.Projects.First()); _projects.Add(info); } } foreach (var p in _projects) { p.SelectedChanged += (sender, e) => { ActionEnabled = _projects.Any(i => i.Selected); }; } ActionEnabled = _projects.Any(i => i.Selected); OnPropertyChanged("Projects"); }