|
| 1 | +using System.Runtime.Remoting.Channels; |
| 2 | + |
1 | 3 | using ExtensionManager.Manifest; |
2 | 4 | using ExtensionManager.UI.Utils; |
3 | 5 | using ExtensionManager.UI.ViewModels; |
@@ -61,19 +63,33 @@ private async Task ShowExportDialogAsync(IExportWorker worker, IManifest manifes |
61 | 63 | await ShowInstallExportDialogAsync(vm); |
62 | 64 | } |
63 | 65 |
|
64 | | - public Task ShowInstallDialogAsync(IInstallWorker worker, IManifest manifest, IReadOnlyCollection<IVSExtension> installedExtensions) |
65 | | - => ShowInstallForSolutionDialogAsync(worker, manifest, installedExtensions, forSolution: false); |
66 | | - public Task ShowInstallForSolutionDialogAsync(IInstallWorker worker, IManifest manifest, IReadOnlyCollection<IVSExtension> installedExtensions) |
67 | | - => ShowInstallForSolutionDialogAsync(worker, manifest, installedExtensions, forSolution: true); |
68 | | - private async Task ShowInstallForSolutionDialogAsync(IInstallWorker worker, IManifest manifest, IReadOnlyCollection<IVSExtension> installedExtensions, bool forSolution) |
| 66 | + public Task ShowInstallDialogAsync(IInstallWorker worker, IManifest manifest, IReadOnlyCollection<VSExtensionToInstall> extensions) |
| 67 | + => ShowInstallForSolutionDialogAsync(worker, manifest, extensions, forSolution: false); |
| 68 | + public Task ShowInstallForSolutionDialogAsync(IInstallWorker worker, IManifest manifest, IReadOnlyCollection<VSExtensionToInstall> extensions) |
| 69 | + => ShowInstallForSolutionDialogAsync(worker, manifest, extensions, forSolution: true); |
| 70 | + private async Task ShowInstallForSolutionDialogAsync(IInstallWorker worker, IManifest manifest, IReadOnlyCollection<VSExtensionToInstall> extensions, bool forSolution) |
69 | 71 | { |
70 | 72 | var vm = new InstallDialogViewModel(worker, manifest, forSolution); |
71 | 73 |
|
72 | | - foreach (var ext in manifest.Extensions) |
| 74 | + foreach (var (extension, status) in extensions) |
73 | 75 | { |
74 | | - var isInstalled = installedExtensions.Contains(ext, ExtensionEqualityComparerById.Instance); |
| 76 | + switch (status) |
| 77 | + { |
| 78 | + case VSExtensionStatus.Installed: |
| 79 | + vm.AddExtension(extension, canBeSelected: false, group: "Already installed"); |
| 80 | + break; |
| 81 | + |
| 82 | + case VSExtensionStatus.NotInstalled: |
| 83 | + vm.AddExtension(extension, canBeSelected: true, group: "Extensions"); |
| 84 | + break; |
| 85 | + |
| 86 | + case VSExtensionStatus.NotSupported: |
| 87 | + vm.AddExtension(extension, canBeSelected: false, group: "Not supported"); |
| 88 | + break; |
75 | 89 |
|
76 | | - vm.AddExtension(ext, isInstalled); |
| 90 | + default: |
| 91 | + throw new InvalidOperationException($"Unknown status {status} for extension {extension.Id}"); |
| 92 | + } |
77 | 93 | } |
78 | 94 |
|
79 | 95 | await ShowInstallExportDialogAsync(vm); |
|
0 commit comments