public override bool Deactivate() { for (int i = 0; i < snapEnvironment.SnapAgentCount; i++) { if (snapEnvironment.get_SnapAgent(i).Equals(featureSnapAgent)) { snapEnvironment.RemoveSnapAgent(i); } } return(base.Deactivate()); }
private void reverseAgentsPriority_Click(object sender, EventArgs e) { //get all the snap agents in reverse order and then deactivate them ArrayList snapAgentList = new ArrayList(); for (int i = snapEnvironment.SnapAgentCount - 1; i >= 0; i--) { IEngineSnapAgent tmpAgent = snapEnvironment.get_SnapAgent(i); snapAgentList.Add(tmpAgent); snapEnvironment.RemoveSnapAgent(i); } //add the agents back to the environment foreach (IEngineSnapAgent agent in snapAgentList) { snapEnvironment.AddSnapAgent(agent); } //refresh this window RefreshDisplay(); }