Пример #1
0
        private static void FSM_ChangeState(object sender, FSMChangeEventArgs e)
        {
            // 主逻辑运行
            if (e.State.ID == FSMStaDef.RUN)
            {
                LogicMain.Start();
                foreach (var item in TaskManager.Default.LogicTasks)
                {
                    if (item.LG.Step != 0)
                    {
                        item.Start();
                    }
                }
            }

            // 复位逻辑运行
            if (e.State.ID == FSMStaDef.RESET)
            {
                ResetLogic.Start();
            }

            // 点击停止,部分逻辑可能不能停止,需要继续运行
            if (e.State.ID == FSMStaDef.STOP)
            {
                foreach (var item in TaskManager.Default.LogicTasks)
                {
                    item.Stop();
                }
            }

            if (e.State.ID == FSMStaDef.PAUSE)
            {
                foreach (var item in TaskManager.Default.LogicTasks)
                {
                    item.Stop();
                }
            }

            // 急停,所有的逻辑全部停止
            if (e.State.ID == FSMStaDef.SCRAM)
            {
                foreach (var item in TaskManager.Default.LogicTasks)
                {
                    item.Stop();
                }
            }
        }
Пример #2
0
 private static void FSM_ChangeState(object sender, FSMChangeEventArgs e)
 {
     //
     if (e.State.ID == FSMStaDef.RUN)
     {
         LogicMain.Start();
     }
     // 复位逻辑卷运行
     if (e.State.ID == FSMStaDef.RESET)
     {
         ResetLogic.Start();
     }
     // 点击停止,部分逻辑可能不能停止,需要继续运行
     if (e.State.ID == FSMStaDef.STOP)
     {
         foreach (var item in TaskManager.Default.LogicTasks)
         {
             if (item.Name != "")
             {
                 item.Stop();
             }
         }
     }
     // 急停,所有的逻辑全部停止
     if (e.State.ID == FSMStaDef.SCRAM || e.State.ID == FSMStaDef.ERROR)
     {
         foreach (var item in TaskManager.Default.LogicTasks)
         {
             item.Stop();
         }
     }
     if (e.State.ID == FSMStaDef.ALARM)
     {
         foreach (var item in TaskManager.Default.LogicTasks)
         {
             if (item.Name != "")
             {
                 item.Stop();
             }
         }
     }
 }