public override void setup() { object[] args = this.getArguments(); if (args != null) { windowsForm = (FormAgent)args[0]; } windowsForm.Text = this.getName(); windowsForm.Show(); providerAID = YellowPages.FindService("AuctionService", this, 10); if (providerAID == null) { windowsForm.AddTextLine("No auction provider found."); } else { windowsForm.AddTextLine("Found auction provider: " + providerAID.getLocalName()); addBehaviour(new BuyerRegister(this)); addBehaviour(new BuyerReceive(this)); } }
public override void setup() { object[] args = this.getArguments(); if (args != null) windowsForm = (FormAgent)args[0]; participantList = new List<AID>(); currentPrice = (new Random()).Next(maxStartingPrice); windowsForm.Text = this.getName(); windowsForm.Show(); YellowPages.RegisterService("AuctionService", this); windowsForm.AddTextLine("Registered AuctionService"); addBehaviour(new ManagerReceive(this)); addBehaviour(new ManagerSend(this, auctionCallInterval)); }
public static void DoInitialization() { //create main container jade.wrapper.AgentContainer mainContainer = CreateContainer("Container1M", true, "localhost", null, "1090"); mainContainer.start(); FormAgent managerAgentForm = new FormAgent(); managerAgentForm.Location = new Point(50, 50); FormAgent agent1Form = new FormAgent(); agent1Form.Location = new Point(500, 50); FormAgent agent2Form = new FormAgent(); agent2Form.Location = new Point(50, 350); FormAgent agent3Form = new FormAgent(); agent3Form.Location = new Point(500, 350); //create and start auction manager and participants jade.wrapper.AgentController managerAg = CreateAgent(mainContainer, "managerAgent", "AgentAuction.AuctionManager", new object[] { managerAgentForm }); jade.wrapper.AgentController ag1 = CreateAgent(mainContainer, "Buyer1", "AgentAuction.BuyerAgent", new object[] { agent1Form }); jade.wrapper.AgentController ag2 = CreateAgent(mainContainer, "Buyer2", "AgentAuction.BuyerAgent", new object[] { agent2Form }); jade.wrapper.AgentController ag3 = CreateAgent(mainContainer, "Buyer3", "AgentAuction.BuyerAgent", new object[] { agent3Form }); managerAg.start(); ag1.start(); ag2.start(); ag3.start(); }