Slideshow timer resets when user hits next

This commit is contained in:
Justin Swanson 2019-10-14 19:38:16 -05:00
parent f6290e7165
commit f7b35198ec
2 changed files with 15 additions and 5 deletions

View File

@ -3,6 +3,7 @@
#### Unreleased changes
* Nothing yet...
* Slideshow more responsive on pressing next
* Slideshow timer resets when next is pressed
#### Version 1.0 alpha 2 - 10/15/2019
* Fix installer running in wrong mode

View File

@ -137,13 +137,22 @@ namespace Wabbajack
.DisposeWith(this.CompositeDisposable);
/// Wire slideshow updates
// Merge all the sources that trigger a slideshow update
var intervalSeconds = 10;
// Compile all the sources that trigger a slideshow update
Observable.Merge(
// If the natural timer fires
Observable.Interval(TimeSpan.FromSeconds(10)).Unit(),
// If user requests one manually
this.SlideShowNextItemCommand.StartingExecution())
// When enabled, fire an initial signal
this.SlideShowNextItemCommand.StartingExecution(),
// If the natural timer fires
Observable.Merge(
// Start with an initial timer
Observable.Return(Observable.Interval(TimeSpan.FromSeconds(intervalSeconds))),
// but reset timer if user requests one
this.SlideShowNextItemCommand.StartingExecution()
.Select(_ => Observable.Interval(TimeSpan.FromSeconds(intervalSeconds))))
// When a new timer comes in, swap to it
.Switch()
.Unit())
// When filter switch enabled, fire an initial signal
.StartWith(Unit.Default)
// Only subscribe to slideshow triggers if enabled and installing
.FilterSwitch(