@ -6,27 +6,15 @@ namespace RenderDemo.ViewModels
{
public class AnimationsPageViewModel : ReactiveObject
{
private string _ playStateText = "Pause all animations" ;
private bool _ isPlaying = true ;
public AnimationsPageViewModel ( )
{
ToggleGlobalPlayState = ReactiveCommand . Create ( ( ) = > TogglePlayState ( ) ) ;
}
private string _ playStateText = "Pause all animations" ;
void TogglePlayState ( )
public void TogglePlayState ( )
{
switch ( Animation . GlobalPlayState )
{
case PlayState . Run :
PlayStateText = "Resume all animations" ;
Animation . GlobalPlayState = PlayState . Pause ;
break ;
case PlayState . Pause :
PlayStateText = "Pause all animations" ;
Animation . GlobalPlayState = PlayState . Run ;
break ;
}
PlayStateText = _ isPlaying
? "Resume animations on this page" : "Pause animations on this page" ;
_ isPlaying = ! _ isPlaying ;
}
public string PlayStateText
@ -34,7 +22,5 @@ namespace RenderDemo.ViewModels
get { return _ playStateText ; }
set { this . RaiseAndSetIfChanged ( ref _ playStateText , value ) ; }
}
public ReactiveCommand ToggleGlobalPlayState { get ; }
}
}