diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-12-30 15:32:57 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-12-30 18:40:49 -0600 |
commit | 8dfadd0c9068965af138949b630ef8496b4f7bbb (patch) | |
tree | 58bc40d5306d80a39712470aab0d5bf325eb3a45 /src/test/burn/WixToolset.WixBA | |
parent | 84a1b0f8ffe40a26916b1dfb3e1b59b6b0c31ad4 (diff) | |
download | wix-8dfadd0c9068965af138949b630ef8496b4f7bbb.tar.gz wix-8dfadd0c9068965af138949b630ef8496b4f7bbb.tar.bz2 wix-8dfadd0c9068965af138949b630ef8496b4f7bbb.zip |
Don't report related operation in OnDetectRelatedBundle.
#5796
Diffstat (limited to 'src/test/burn/WixToolset.WixBA')
-rw-r--r-- | src/test/burn/WixToolset.WixBA/InstallationViewModel.cs | 47 | ||||
-rw-r--r-- | src/test/burn/WixToolset.WixBA/RootViewModel.cs | 23 |
2 files changed, 54 insertions, 16 deletions
diff --git a/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs b/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs index 1846d51b..e056b943 100644 --- a/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs +++ b/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs | |||
@@ -19,6 +19,18 @@ namespace WixToolset.WixBA | |||
19 | { | 19 | { |
20 | Absent, | 20 | Absent, |
21 | Present, | 21 | Present, |
22 | } | ||
23 | |||
24 | /// <summary> | ||
25 | /// The states of upgrade detection. | ||
26 | /// </summary> | ||
27 | public enum UpgradeDetectionState | ||
28 | { | ||
29 | // There are no Upgrade related bundles installed. | ||
30 | None, | ||
31 | // All Upgrade related bundles that are installed are older than or the same version as this bundle. | ||
32 | Older, | ||
33 | // At least one Upgrade related bundle is installed that is newer than this bundle. | ||
22 | Newer, | 34 | Newer, |
23 | } | 35 | } |
24 | 36 | ||
@@ -90,7 +102,7 @@ namespace WixToolset.WixBA | |||
90 | 102 | ||
91 | void RootPropertyChanged(object sender, PropertyChangedEventArgs e) | 103 | void RootPropertyChanged(object sender, PropertyChangedEventArgs e) |
92 | { | 104 | { |
93 | if (("DetectState" == e.PropertyName) || ("InstallState" == e.PropertyName)) | 105 | if (("DetectState" == e.PropertyName) || ("UpgradeDetectState" == e.PropertyName) || ("InstallState" == e.PropertyName)) |
94 | { | 106 | { |
95 | base.OnPropertyChanged("RepairEnabled"); | 107 | base.OnPropertyChanged("RepairEnabled"); |
96 | base.OnPropertyChanged("InstallEnabled"); | 108 | base.OnPropertyChanged("InstallEnabled"); |
@@ -276,7 +288,9 @@ namespace WixToolset.WixBA | |||
276 | { | 288 | { |
277 | if (this.installCommand == null) | 289 | if (this.installCommand == null) |
278 | { | 290 | { |
279 | this.installCommand = new RelayCommand(param => WixBA.Plan(LaunchAction.Install), param => this.root.DetectState == DetectionState.Absent && this.root.InstallState == InstallationState.Waiting); | 291 | this.installCommand = new RelayCommand( |
292 | param => WixBA.Plan(LaunchAction.Install), | ||
293 | param => this.root.DetectState == DetectionState.Absent && this.root.UpgradeDetectState != UpgradeDetectionState.Newer && this.root.InstallState == InstallationState.Waiting); | ||
280 | } | 294 | } |
281 | 295 | ||
282 | return this.installCommand; | 296 | return this.installCommand; |
@@ -399,9 +413,19 @@ namespace WixToolset.WixBA | |||
399 | 413 | ||
400 | private void DetectedRelatedBundle(object sender, DetectRelatedBundleEventArgs e) | 414 | private void DetectedRelatedBundle(object sender, DetectRelatedBundleEventArgs e) |
401 | { | 415 | { |
402 | if (e.Operation == RelatedOperation.Downgrade) | 416 | if (e.RelationType == RelationType.Upgrade) |
403 | { | 417 | { |
404 | this.Downgrade = true; | 418 | if (WixBA.Model.Engine.CompareVersions(this.Version, e.Version) > 0) |
419 | { | ||
420 | if (this.root.UpgradeDetectState == UpgradeDetectionState.None) | ||
421 | { | ||
422 | this.root.UpgradeDetectState = UpgradeDetectionState.Older; | ||
423 | } | ||
424 | } | ||
425 | else | ||
426 | { | ||
427 | this.root.UpgradeDetectState = UpgradeDetectionState.Newer; | ||
428 | } | ||
405 | } | 429 | } |
406 | 430 | ||
407 | if (!WixBA.Model.BAManifest.Bundle.Packages.ContainsKey(e.ProductCode)) | 431 | if (!WixBA.Model.BAManifest.Bundle.Packages.ContainsKey(e.ProductCode)) |
@@ -432,19 +456,10 @@ namespace WixToolset.WixBA | |||
432 | } | 456 | } |
433 | else if (Hresult.Succeeded(e.Status)) | 457 | else if (Hresult.Succeeded(e.Status)) |
434 | { | 458 | { |
435 | if (this.Downgrade) | 459 | if (this.root.UpgradeDetectState == UpgradeDetectionState.Newer) |
436 | { | 460 | { |
437 | this.root.DetectState = DetectionState.Newer; | 461 | this.Downgrade = true; |
438 | var relatedPackages = WixBA.Model.BAManifest.Bundle.Packages.Values.Where(p => p.Type == PackageType.UpgradeBundle); | 462 | this.DowngradeMessage = "There is already a newer version of WiX installed on this machine."; |
439 | var installedVersion = relatedPackages.Any() ? new Version(relatedPackages.Max(p => p.Version)) : null; | ||
440 | if (installedVersion != null && installedVersion < new Version(4, 1) && installedVersion.Build > 10) | ||
441 | { | ||
442 | this.DowngradeMessage = "You must uninstall WiX v" + installedVersion + " before you can install this."; | ||
443 | } | ||
444 | else | ||
445 | { | ||
446 | this.DowngradeMessage = "There is already a newer version of WiX installed on this machine."; | ||
447 | } | ||
448 | } | 463 | } |
449 | 464 | ||
450 | if (LaunchAction.Layout == WixBA.Model.Command.Action) | 465 | if (LaunchAction.Layout == WixBA.Model.Command.Action) |
diff --git a/src/test/burn/WixToolset.WixBA/RootViewModel.cs b/src/test/burn/WixToolset.WixBA/RootViewModel.cs index 8cff7274..2dfd214e 100644 --- a/src/test/burn/WixToolset.WixBA/RootViewModel.cs +++ b/src/test/burn/WixToolset.WixBA/RootViewModel.cs | |||
@@ -27,6 +27,7 @@ namespace WixToolset.WixBA | |||
27 | private bool canceled; | 27 | private bool canceled; |
28 | private InstallationState installState; | 28 | private InstallationState installState; |
29 | private DetectionState detectState; | 29 | private DetectionState detectState; |
30 | private UpgradeDetectionState upgradeDetectState; | ||
30 | 31 | ||
31 | /// <summary> | 32 | /// <summary> |
32 | /// Creates a new model of the root view. | 33 | /// Creates a new model of the root view. |
@@ -120,6 +121,28 @@ namespace WixToolset.WixBA | |||
120 | } | 121 | } |
121 | 122 | ||
122 | /// <summary> | 123 | /// <summary> |
124 | /// Gets and sets the upgrade detect state of the view's model. | ||
125 | /// </summary> | ||
126 | public UpgradeDetectionState UpgradeDetectState | ||
127 | { | ||
128 | get | ||
129 | { | ||
130 | return this.upgradeDetectState; | ||
131 | } | ||
132 | |||
133 | set | ||
134 | { | ||
135 | if (this.upgradeDetectState != value) | ||
136 | { | ||
137 | this.upgradeDetectState = value; | ||
138 | |||
139 | // Notify all the properties derived from the state that the state changed. | ||
140 | base.OnPropertyChanged("UpgradeDetectState"); | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | |||
145 | /// <summary> | ||
123 | /// Gets and sets the installation state of the view's model. | 146 | /// Gets and sets the installation state of the view's model. |
124 | /// </summary> | 147 | /// </summary> |
125 | public InstallationState InstallState | 148 | public InstallationState InstallState |