private void UpdateDialog()
 {
     _dialog.UpdateProgress(
         _message,
         szProgressText: null,
         szStatusBarText: null,
         iCurrentStep: this.ProgressTracker.CompletedItems,
         iTotalSteps: this.ProgressTracker.TotalItems,
         fDisableCancel: !_allowCancel,
         pfCanceled: out var hasCancelled);
 }
Example #2
0
        private void UpdateDialog()
        {
            bool hasCancelled;

            _dialog.UpdateProgress(
                _message,
                szProgressText: null,
                szStatusBarText: null,
                iCurrentStep: 0,
                iTotalSteps: 0,
                fDisableCancel: !_allowCancel,
                pfCanceled: out hasCancelled);
        }
        public void Update(string?message = null, int?currentStep = null, int?totalSteps = null, string?progressText = null)
        {
            bool hasChange = false;

            if (message is not null && !Equals(_message, message))
            {
                _message  = message;
                hasChange = true;
            }

            if (totalSteps is not null && totalSteps != _totalSteps)
            {
                _totalSteps = totalSteps.Value;
                hasChange   = true;
            }

            if (currentStep is not null && currentStep != _currentStep)
            {
                Requires.Argument(currentStep <= _totalSteps, nameof(currentStep), $"Must be less than or equal to the total number of steps.");

                _currentStep = currentStep.Value;
                hasChange    = true;
            }

            if (!Equals(progressText, _progressText))
            {
                _progressText = progressText;
                hasChange     = true;
            }

            if (hasChange)
            {
                _dialog.UpdateProgress(
                    _message,
                    szProgressText: _progressText,
                    szStatusBarText: null,
                    iCurrentStep: _currentStep,
                    iTotalSteps: _totalSteps,
                    fDisableCancel: _cancellationTokenSource is null,
                    pfCanceled: out _);
            }
        }