Defines additional methods for a StateMachine
示例#1
0
        /// <summary>
        /// Called when the program changes state.
        /// </summary>
        public void Simulation_TransitionInitiated(OperationContext context, StateMachine machine, StateMachineTransitionEventArgs e)
        {
            lock (DataLock)
            {
                switch (e.ToState.Name)
                {
                    case Opc.Ua.BrowseNames.Ready:
                    {
                        if (m_timer != null)
                        {
                            m_timer.Dispose();
                            m_timer = null;
                        }

                        break;
                    }

                    case Opc.Ua.BrowseNames.Suspended:
                    case Opc.Ua.BrowseNames.Halted:
                    {
                        if (m_timer != null)
                        {
                            m_timer.Dispose();
                            m_timer = null;
                        }

                        break;
                    }

                    case Opc.Ua.BrowseNames.Running:
                    {
                        OnStartSimulation();
                        break;
                    }
                }
            }
        }