public ActionResult Display(string ip, int port, int?time = 0) { FlightModel flightModel = FlightModel.Instance; FlightModel.Instance.InitializeList(); FlightModel.Instance.SetCountDisplays(); ViewBag.countDisplays = FlightModel.Instance.GetCountDisplays(); System.Net.IPAddress validIp = null; ViewBag.readFromFile = 0; // Check if the given parameter is valid ip address if (System.Net.IPAddress.TryParse(ip, out validIp)) { // Connect to the simulator server with the appropriate ip and port flightModel.InitialClient(ip, port); ViewBag.time = time; } else { // update the variables according to the third option ViewBag.readFromFile = 1; ViewBag.time = port; ViewBag.fileName = ip; } return(View()); }
public ActionResult Save(string ip, int port, int frequency, int duration, string fileName) { FlightModel flightModel = FlightModel.Instance; FlightModel.Instance.InitializeList(); // Conect to the simulator server flightModel.InitialClient(ip, port); // Save the parameters flightModel.SetNumSamples(duration / frequency); ViewBag.frequency = frequency; ViewBag.duration = duration; ViewBag.fileName = fileName; return(View()); }