public static DividableProgress ToDividableProgress(this IProgress <float> progress) { var dividableProgress = progress as DividableProgress; if (dividableProgress == null && progress != null) { dividableProgress = new DividableProgress(); dividableProgress.Subscribe(progress.Report); } return(dividableProgress); }
public DividableProgress Divide(float weight) { if (cancel == null) { cancel = new CompositeDisposable(); } var divide = new DividableProgress(); float last = 0; divide.Subscribe(current => { float delta = current - last; last = current; inner.Value += delta * weight; }).AddTo(cancel); return(divide); }