public static void Execute(State state)
 {
     AgentClient agent = new AgentClient(GetAddress());
     PRIORITIES[ACTIVE_AGENT_ID].Push(ACTIVE_AGENT_ID);
     agent.TestMethod(new ExecuteInfo { AgentId = ACTIVE_AGENT_ID, ProdId = state.StateInfo, StateId = state.StateId, Message = state.StateName, StateName = state.StateName });
     agent.Close();
 }
Beispiel #2
0
 private static void RunState(State state)
 {
     if (state != null)
     {
         AgentClientManager.Execute(state);
         state.Status = StateStatus.RUNNING;
     }
 }
Beispiel #3
0
        public static void SetStates(int prodId)
        {
            if (!PRODS.ContainsKey(prodId))
            {
                Queue<State> states = new Queue<State>();

                states.Enqueue(new State() { StateInfo = prodId, StateName = "one" });
                State state = new State { StateInfo = prodId, StateName = "two" };
                state.PreStates = new List<State>
               {
                   new State{ StateInfo=prodId, StateName="pre-one"},
                    new State{ StateInfo=prodId, StateName="pre-two",
                        PreStates=new List<State>{
                            new State{ StateInfo=prodId, StateName="pre-two-pre-one"},
                            new State{ StateInfo=prodId, StateName="pre-two-pre-two"},
                            new State{ StateInfo=prodId, StateName="pre-two-pre-three"},
                            new State{ StateInfo=prodId, StateName="pre-two-pre-four"},
                            new State{ StateInfo=prodId, StateName="pre-two-pre-five",
                               PreStates=new List<State>{
                                    new State{ StateInfo=prodId, StateName="pre-two-pre-five-pre-one"},
                                }
                            },
                        }
                    },
                     new State{ StateInfo=prodId, StateName="pre-three"},
                      new State{ StateInfo=prodId, StateName="pre-four"}
               };
                states.Enqueue(state);
                states.Enqueue(new State() { StateInfo = prodId, StateName = "three" });
                PRODS.Add(prodId, states);
            }
        }
Beispiel #4
0
 private static void ProcessState(int prodId, State state)
 {
     if (state.PreStates != null && state.PreStates.Count > 0)
     {
         int count = 1;
         bool allPreStateDone = true;
         foreach (var preState in state.PreStates)
         {
             allPreStateDone &= preState.Status == StateStatus.DONE;
             if (preState.Status == StateStatus.STOP && count <= AgentClientManager.COUNT)
             {
                 ProcessPreState(prodId, preState);
                 count++;
             }
         }
         if (count == 1 && allPreStateDone)
         {
             RunState(PRODS[prodId].Dequeue());
         }
     }
     else
     {
         RunState(PRODS[prodId].Dequeue());
     }
 }