public void Toggle(Action <Duration> onNext) { current = current.ToggledAndLogged(log); var previous = log.Aggregate(Duration.Zero, (a, b) => a + b); subscription.Dispose(); subscription = current.LoggedTime .Subscribe(current => onNext(current + previous)); }
internal void Toggle(Action <Duration> onNext) { if (current.Running) { periods.Add(current.Stopped()); current = new TaaskPeriod(clock); } else { current.Start(duration => onNext(duration + periods.Aggregate(Duration.Zero, (a, b) => a + b))); } }
// What about checks? public TaaskPeriods(IClock clock) { this.clock = clock; current = new TaaskPeriod(clock); }