卸载时,wix中的进度条表现不同

时间:2016-04-10 23:58:38

标签: wix windows-installer bootstrapper burn wix3.8

我已经为我的bootstrapper安装程序创建了一个进度条。安装时它正确地达到100%。但卸载它只会达到50%并停在那里。以下是我的代码。

在我的ViewModel类的构造函数中。

this.Bootstrapper.CacheAcquireProgress += (sender, args) =>
            {
                this.cacheProgress = args.OverallPercentage;
                this.Progress = (this.cacheProgress + this.executeProgress) / 2;
            };
            this.Bootstrapper.ExecuteProgress += (sender, args) =>
            {
                this.executeProgress = args.OverallPercentage;
                this.Progress = (this.cacheProgress + this.executeProgress) / 2;
            };

然后getter和setter如下。

  private int progress;
        public int Progress
        {
            get { return progress; }
            set
            {
                this.progress = value;
                RaisePropertyChanged("Progress");
            }
        }

        private int cacheProgress;
        private int executeProgress;

我在这里做错了什么?卸载时为什么栏保持在50%,但卸载完成了?请指教。

1 个答案:

答案 0 :(得分:2)

并非每个Apply操作都有一个缓存阶段,请使用OnApplyPhaseCount(在OnApplyBegin)回调中的v4中来了解该分母应该是什么。