aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.WixBA/InstallationViewModel.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/WixToolset.WixBA/InstallationViewModel.cs35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/WixToolset.WixBA/InstallationViewModel.cs b/src/WixToolset.WixBA/InstallationViewModel.cs
index c7b736ff..2beebd02 100644
--- a/src/WixToolset.WixBA/InstallationViewModel.cs
+++ b/src/WixToolset.WixBA/InstallationViewModel.cs
@@ -79,11 +79,11 @@ namespace WixToolset.WixBA
79 WixBA.Model.Bootstrapper.PlanComplete += this.PlanComplete; 79 WixBA.Model.Bootstrapper.PlanComplete += this.PlanComplete;
80 WixBA.Model.Bootstrapper.ApplyBegin += this.ApplyBegin; 80 WixBA.Model.Bootstrapper.ApplyBegin += this.ApplyBegin;
81 WixBA.Model.Bootstrapper.CacheAcquireBegin += this.CacheAcquireBegin; 81 WixBA.Model.Bootstrapper.CacheAcquireBegin += this.CacheAcquireBegin;
82 WixBA.Model.Bootstrapper.CacheAcquireResolving += this.CacheAcquireResolving;
82 WixBA.Model.Bootstrapper.CacheAcquireComplete += this.CacheAcquireComplete; 83 WixBA.Model.Bootstrapper.CacheAcquireComplete += this.CacheAcquireComplete;
83 WixBA.Model.Bootstrapper.ExecutePackageBegin += this.ExecutePackageBegin; 84 WixBA.Model.Bootstrapper.ExecutePackageBegin += this.ExecutePackageBegin;
84 WixBA.Model.Bootstrapper.ExecutePackageComplete += this.ExecutePackageComplete; 85 WixBA.Model.Bootstrapper.ExecutePackageComplete += this.ExecutePackageComplete;
85 WixBA.Model.Bootstrapper.Error += this.ExecuteError; 86 WixBA.Model.Bootstrapper.Error += this.ExecuteError;
86 WixBA.Model.Bootstrapper.ResolveSource += this.ResolveSource;
87 WixBA.Model.Bootstrapper.ApplyComplete += this.ApplyComplete; 87 WixBA.Model.Bootstrapper.ApplyComplete += this.ApplyComplete;
88 } 88 }
89 89
@@ -492,9 +492,32 @@ namespace WixToolset.WixBA
492 this.cachePackageStart = DateTime.Now; 492 this.cachePackageStart = DateTime.Now;
493 } 493 }
494 494
495 private void CacheAcquireResolving(object sender, CacheAcquireResolvingEventArgs e)
496 {
497 if (e.Action == CacheResolveOperation.Download && !this.downloadRetries.ContainsKey(e.PackageOrContainerId))
498 {
499 this.downloadRetries.Add(e.PackageOrContainerId, 0);
500 }
501 }
502
495 private void CacheAcquireComplete(object sender, CacheAcquireCompleteEventArgs e) 503 private void CacheAcquireComplete(object sender, CacheAcquireCompleteEventArgs e)
496 { 504 {
497 this.AddPackageTelemetry("Cache", e.PackageOrContainerId ?? String.Empty, DateTime.Now.Subtract(this.cachePackageStart).TotalMilliseconds, e.Status); 505 this.AddPackageTelemetry("Cache", e.PackageOrContainerId ?? String.Empty, DateTime.Now.Subtract(this.cachePackageStart).TotalMilliseconds, e.Status);
506
507 if (e.Status < 0 && this.downloadRetries.TryGetValue(e.PackageOrContainerId, out var retries) && retries < 3)
508 {
509 this.downloadRetries[e.PackageOrContainerId] = retries + 1;
510 switch (e.Status)
511 {
512 case -2147023294: //HRESULT_FROM_WIN32(ERROR_INSTALL_USEREXIT)
513 case -2147024894: //HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)
514 case -2147012889: //HRESULT_FROM_WIN32(ERROR_INTERNET_NAME_NOT_RESOLVED)
515 break;
516 default:
517 e.Action = BOOTSTRAPPER_CACHEACQUIRECOMPLETE_ACTION.Retry;
518 break;
519 }
520 }
498 } 521 }
499 522
500 private void ExecutePackageBegin(object sender, ExecutePackageBeginEventArgs e) 523 private void ExecutePackageBegin(object sender, ExecutePackageBeginEventArgs e)
@@ -584,16 +607,6 @@ namespace WixToolset.WixBA
584 } 607 }
585 } 608 }
586 609
587 private void ResolveSource(object sender, ResolveSourceEventArgs e)
588 {
589 int retries = 0;
590
591 this.downloadRetries.TryGetValue(e.PackageOrContainerId, out retries);
592 this.downloadRetries[e.PackageOrContainerId] = retries + 1;
593
594 e.Action = retries < 3 && !String.IsNullOrEmpty(e.DownloadSource) ? BOOTSTRAPPER_RESOLVESOURCE_ACTION.Download : BOOTSTRAPPER_RESOLVESOURCE_ACTION.None;
595 }
596
597 private void ApplyComplete(object sender, ApplyCompleteEventArgs e) 610 private void ApplyComplete(object sender, ApplyCompleteEventArgs e)
598 { 611 {
599 WixBA.Model.Result = e.Status; // remember the final result of the apply. 612 WixBA.Model.Result = e.Status; // remember the final result of the apply.