//This SA will act as a Simulation Manager public void CreateSimulation(object sender, RoutedEventArgs e) { String simId = Sim_ID.Text; String simName = Sim_Name.Text; if(simId.Length > SIM_ID_MAX_LENGTH || simId.Length < SIM_ID_MIN_LENGTH){ MessageBox.Show("Simulation ID requires at least 5-36 characters"); return; } if (simName.Length > SIM_NAME_MAX_LENGTH) { MessageBox.Show("Simulation Name must be less than 50 characters"); return; } else if (simName == "") Sim_Name.Text = simName = "Cyber Threat Simulation #" + simId; //start a sim manager _simConfig.APP_ROLE = SimulationRunningConfig.ROLE_MANAGER; _simConfig.SIM_ID = simId; _simConfig.SIM_NAME = simName; if(Sim_Description.Text == "") _simConfig.SIM_DESCRIPTION = "None"; else _simConfig.SIM_DESCRIPTION = Sim_Description.Text; AppRoleTextBox.Text = "ROLE: MANAGER"; //start a new simulation as the simulation manager _simManager = new SimulationManagementHelper(_simConfig, DATA_SOURCE_STRING); _simManager.startBroadcastingSimulation(); //add manager to list //generate this managers sim application config and add to participant list XMLSimApplication saConfig = new XMLSimApplication(); saConfig.ElementId = SimulationManagementHelper.generateElementId(); saConfig.ParticipantId = _simConfig.APP_ID; saConfig.ParticipantIp = _simConfig.LOCAL_IP_ADDRESS; saConfig.ParticipantRole = _simConfig.APP_ROLE; saConfig.SystemProfile = _simConfig._systemProfile; saConfig.loadSimApplicationConfiguration(_simConfig); saConfig.Status = "Listening"; //Note that the NetworkConnectionState is null because the manager will not be communicating with itself //In addition, SA should not communicate with each other unless sending through the UDP network, they only //communicate with the manager at the time of connection setup or rejoin if disconnected. SimulationParticipant manager = new SimulationParticipant(saConfig, new NetworkConnectionState()); _participantList.Add(saConfig.ParticipantId, manager); startSimulationServer(); }