Skip to content

Instantly share code, notes, and snippets.

@rdelrosario
Created October 27, 2021 19:07
Show Gist options
  • Save rdelrosario/be4304c251a23f1461d12656bdfb21e7 to your computer and use it in GitHub Desktop.
Save rdelrosario/be4304c251a23f1461d12656bdfb21e7 to your computer and use it in GitHub Desktop.
public class MainViewModel : INotifyPropertyChanged
{
public MainViewModel()
{
_videoPlayerStateMachine.Configure(VideoState.Playing)
.OnActivate(OnStateEntry)
.OnEntry(OnStateEntry)
.PermitReentryIf(VideoTrigger.Forward)
.PermitReentryIf(VideoTrigger.Rewind)
.Permit(VideoTrigger.Pause, VideoState.Paused)
.Permit(VideoTrigger.Stop, VideoState.Stopped)
.OnEntryFrom(rewindParamTrigger, (seconds) => {
MainThread.BeginInvokeOnMainThread(() =>
{
Position = Position.Subtract(TimeSpan.FromSeconds(seconds));
});
})
.OnEntryFrom(forwardParamTrigger, (seconds) => {
MainThread.BeginInvokeOnMainThread(() =>
{
Position = Position.Add(TimeSpan.FromSeconds(seconds));
});
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment