private double GetCurrentProgress() { if (this.currentValue == this.maxNumberOfIncrements) { return 1.0; // avoid rounding/floating point errors for the last step } return (double)this.currentValue / this.maxNumberOfIncrements; } }