You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get some of the basics of stateless and really think it seems miraculous.
I am having trouble wrapping my head around some features that use concepts I don't understand.
Using in .NET, winform c# 8.0
I have a form and a class that controls a robot. I want to use stateless to keep the robot states straight in the robot class and to enable/disable menu options on the form itself. I have defined a couple simple states:
public Robot(RobotOptions settings)
{
_robotOptions = settings;
_stateMachine = new StateMachine<State, Trigger>(State.NotConnected);
//Define Not Connected State
_stateMachine.Configure(State.NotConnected)
.Permit(Trigger.Connect, State.ConnectedNotHomed);
//Connected not homed state
_stateMachine.Configure(State.ConnectedNotHomed)
.Permit(Trigger.Disconnect, State.NotConnected);
_stateMachine.OnTransitioned(a => Log.Information($"Transitioned from: {a.Source} to {a.Destination} via {a.Trigger}."));
}
Now I am clueless as to how to control the menu items on the form based on the states in the stateMachine. My first thought was to create a event in the Robot class itself and define a handler in form. The handler would get notified about the state of the stateMachine.
It looks like there are a couple of events in stateless that fire before and after a state change. This seems perfect but I am not familiar with the form of the parameter that it uses. Further, I'd like the event from the state machine to notify the form class.
Is there someone who could help me with this?
The text was updated successfully, but these errors were encountered:
I get some of the basics of stateless and really think it seems miraculous.
I am having trouble wrapping my head around some features that use concepts I don't understand.
Using in .NET, winform c# 8.0
I have a form and a class that controls a robot. I want to use stateless to keep the robot states straight in the robot class and to enable/disable menu options on the form itself. I have defined a couple simple states:
Now I am clueless as to how to control the menu items on the form based on the states in the stateMachine. My first thought was to create a event in the Robot class itself and define a handler in form. The handler would get notified about the state of the stateMachine.
It looks like there are a couple of events in stateless that fire before and after a state change. This seems perfect but I am not familiar with the form of the parameter that it uses. Further, I'd like the event from the state machine to notify the form class.
Is there someone who could help me with this?
The text was updated successfully, but these errors were encountered: