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