So, Im working on an implementation of a declarative finite state machine in Xojo. We all know that these help us deal with UDP communications, Serial communications, etc…Here is the implementation:
[code] //=======================================
// MyFSM is a subclass of XojoFSM (a Finite State Machine Class)
//=======================================
Dim FSM as New MyFSM
//==========================
// Set up my State Machine Transition Table
//==========================
Call FSM.IfState(MyFSM.ProcessState.Inactive).OnCMD(MyFSM.Command.Play).GoState(MyFSM.ProcessState.Playing).Execute(AddressOf FSM.Play)
Call FSM.IfState(MyFSM.ProcessState.Active).OnCMD(MyFSM.Command.Begin).GoState(MyFSM.ProcessState.Playing).Execute(AddressOf FSM.Play)
Call FSM.IfState(MyFSM.ProcessState.Inactive).OnCMD(MyFSM.Command.Terminate).GoState(MyFSM.ProcessState.Terminated).Execute(AddressOf FSM.Terminate)
Call FSM.IfState(MyFSM.ProcessState.Active).OnCMD(MyFSM.Command.Stop).GoState(MyFSM.ProcessState.Paused).Execute(AddressOF FSM.Pause)
Call FSM.IfState(MyFSM.ProcessState.Paused).OnCMD(MyFSM.Command.Terminate).GoState(MyFSM.ProcessState.Terminated).Execute(AddressOf FSM.Terminate)
//=================
// Initialize our starting state
//=================
FSM.Initialize(MyFSM.ProcessState.Inactive)
//===================
// Start the Finite State Machine
//===================
FSM.Start()
//===============
// Fire our First Command
//===============
FSM.Fire(MyFSM.Command.Begin)
[/code]
This works great right now, however, my question is, is there any way to use the line continuation character here? The with parameter would be awesome!:
Dim FSM as New MyFSM
With FSM.State
.ProcessState.Inactive.OnCMD(MyFSM.Command.Play).GoState(MyFSM.ProcessState.Playing).Execute(AddressOf FSM.Play)
End With