Ejemplo n.º 1
0
 public Agent AddNewAgent(AGENT_TYPE agentType, Image image)
 {
     Agent newAgent = null;
       Environment a = this;
       // Set a random location for the agent
       RectangleF bounds = device.Graphics.VisibleClipBounds;
       PointF location = new PointF((float)(bounds.Width * rnd.NextDouble()),
                            (float)(bounds.Height * rnd.NextDouble()));
       switch (agentType) {
     case AGENT_TYPE.AGENT_CONTROLLER: {
     newAgent = new Controller(ref a, ref messageQueue, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_OPERATOR: {
     newAgent = new Operator(ref a, ref messageQueue, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_LOGISTICS: {
     // Logistics Agent
     newAgent = new TransportAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_SUPPLIER: {
     newAgent = new SupplierAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_MANUFACTURE: {
     newAgent = new ManufacturerAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
     case AGENT_TYPE.AGENT_CLIENT: {
     newAgent = new ClientAgent(ref a, ref messageQueue, location, agents.Count, image, device.Graphics);
     break;
       }
       }
       agents.Add(newAgent);
       if (NewAgent != null)
     NewAgent(this, ref newAgent);
       return newAgent;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 根据agent_type 给UCRowComboBox动态赋值
        /// </summary>
        /// <param name="box"></param>
        /// <param name="agentType"></param>
        private void assignmentCommand(UCRowComboBox box, AGENT_TYPE agentType)
        {
            List <object> commandList = commandBll.SelectAll().Where(p => p.AgentType.Equals(agentType)).ToList <object>();

            box.ResetList(commandList);
        }