void IInvokable.Invoke() { _handling = false; if (_done) { Dispose(); return; } if (_suspended | _canceled) { return; } // Calculate the normalized progress for the depth that the listener was added. // Use double for better precision. double expected = _owner._waitDepthAndProgress.WholePart + 1u; InvokeAndCatch((float)(_current.ToDouble() / expected)); }
void IInvokable.Invoke() { _invokingProgress = false; if (_state != State.Pending | _suspended) { ReleaseInternal(); return; } // Calculate the normalized progress for the depth of the returned promise. // Use double for better precision. double expected = ((Promise)_valueOrPrevious)._waitDepthAndProgress.WholePart + 1u; float progress = (float)(_currentAmount.ToDouble() / expected); uint increment = _waitDepthAndProgress.AssignNewDecimalPartAndGetDifferenceAsUInt32(progress); foreach (var progressListener in _progressListeners) { progressListener.IncrementProgress(this, increment); } ReleaseInternal(); }