Created
January 12, 2022 20:42
-
-
Save rdelrosario/722d1ca518131ec518256d7a6adbd32c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace UberClone.ViewModels | |
{ | |
public class MapPageViewModel : INotifyPropertyChanged | |
{ | |
public XUberState State { get; private set; } | |
public ICommand FireTriggerCommand { get; } | |
private readonly StateMachine<XUberState, XUberTrigger> _stateMachine; | |
public MapPageViewModel() | |
{ | |
var _stateMachine = new StateMachine<XUberState, XUberTrigger>(XUberState.Initial); | |
... | |
FireTriggerCommand = new Command<XUberTrigger>((trigger) => | |
{ | |
if(_stateMachine.CanFire(trigger)) | |
{ | |
_stateMachine.Fire(trigger); | |
State = _stateMachine.State; | |
} | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment